From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5088 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add definition of max_align_t to stddef.h Date: Thu, 8 May 2014 12:57:22 +0200 Message-ID: <20140508105721.GR12324@port70.net> References: <20140507031306.GA26963@brightrain.aerifal.cx> <20140507230729.GD26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1399546673 5773 80.91.229.3 (8 May 2014 10:57:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 10:57:53 +0000 (UTC) Cc: Pawel Dziepak To: musl@lists.openwall.com Original-X-From: musl-return-5094-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 08 12:57:46 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WiM1K-0002Sp-A7 for gllmg-musl@plane.gmane.org; Thu, 08 May 2014 12:57:46 +0200 Original-Received: (qmail 22030 invoked by uid 550); 8 May 2014 10:57:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 22021 invoked from network); 8 May 2014 10:57:36 -0000 Content-Disposition: inline In-Reply-To: <20140507230729.GD26358@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:5088 Archived-At: * Rich Felker [2014-05-07 19:07:29 -0400]: > BTW, is __alignof__(long double) really giving 8? If so that's utter > nonsense. sizeof(long double) is 12, and alignment must always divide > the size of the type... no, long long is 8 though #include #define p(x) printf("%s == %d\n", #x, (int)(x)) int main() { p(__alignof__(long long)); p(__alignof__(long double)); p(__alignof__(union{long long a; long double b;})); p(_Alignof(long long)); p(_Alignof(long double)); p(_Alignof(union{long long a; long double b;})); } gcc 4.8 on i386: __alignof__(long long) == 8 __alignof__(long double) == 4 __alignof__(union{long long a; long double b;}) == 4 _Alignof(long long) == 8 _Alignof(long double) == 4 _Alignof(union{long long a; long double b;}) == 4 gcc 4.9 on i386: __alignof__(long long) == 8 __alignof__(long double) == 4 __alignof__(union{long long a; long double b;}) == 4 _Alignof(long long) == 4 _Alignof(long double) == 4 _Alignof(union{long long a; long double b;}) == 4 gcc 4.9 on arm: __alignof__(long long) == 8 __alignof__(long double) == 8 __alignof__(union{long long a; long double b;}) == 8 _Alignof(long long) == 8 _Alignof(long double) == 8 _Alignof(union{long long a; long double b;}) == 8 > As I see it, we have a choice whether to use the "8" definition on > i386 or use the natural definition, which would yield "4" on i386. > This is not an ABI issue (it does not affect the ability to use > glibc-built object files/binaries/shared libraries with musl, nor the > C++ name mangling ABI) but an API issue. assuming max_align_t does not appear in a function prototype