mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH 3/3] stddef: Define max_align_t
Date: Mon, 28 Apr 2014 10:14:20 -0400	[thread overview]
Message-ID: <20140428141420.GW26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <20140428132645.GH12324@port70.net>

On Mon, Apr 28, 2014 at 03:26:45PM +0200, Szabolcs Nagy wrote:
> * Jens Gustedt <jens.gustedt@inria.fr> [2014-04-28 14:22:44 +0200]:
> > Am Montag, den 28.04.2014, 12:11 +0200 schrieb Szabolcs Nagy:
> > > i think i386 abi is non-conforming to the c11 alignment requirements now:
> > > long long has 8 byte alignment, but in a struct/union it has only 4
> > > (this is why the attrs are needed above)
> > > 
> > > 	long long x; // _Alignof(x) == 8
> > > 	struct {long long x;} y; // _Alignof(y.x) == 4
> > 
> > I don't think that it is non-conforming
> > 
> > _Alignof of a type only tells you on what alignments the programmer
> > may place objects of the corresponding type (if he deals with this
> > manually) and gives no guarantee what the implementation itself choses
> > under all circumstances
> > 
> > this holds especially if a type has "extended alignment", I think
> 
> the standard says
> 
> "An object type imposes an alignment requirement on every object of that
> type: stricter alignment can be requested using the _Alignas keyword."
> 
> "The _Alignof operator yields the alignment requirement of its operand type."
> 
> to me this means that all long long objects should have the same
> alignment requirement and _Alignof should return this consistently
> (unless _Alignas imposes further stricter alignment requirements,
> but it never gets weaker)

This is correct. On i386, _Alignof must both always be 4 for both long
long and long double, regardless of where the operand (if it's an
object rather than a type) exists. If gcc is behaving differently,
this is a very bad bug in GCC that needs to be fixed on their side; I
won't try to work around it.

Rich


  parent reply	other threads:[~2014-04-28 14:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28  1:43 [PATCH 1/3] bits/socket.h: Define SO_RCVBUFFORCE for mips Khem Raj
2014-04-28  1:43 ` [PATCH 2/3] Add soname to dynamic section Khem Raj
2014-04-28  2:00   ` Rich Felker
2014-04-28  5:02     ` Khem Raj
2014-04-28  5:54       ` Isaac Dunham
2014-04-28  6:00         ` Khem Raj
2014-04-28  6:22           ` Isaac Dunham
2014-04-28  6:32             ` Timo Teras
2014-04-28  7:20             ` Khem Raj
2014-04-28 14:28               ` Rich Felker
2014-04-28  1:43 ` [PATCH 3/3] stddef: Define max_align_t Khem Raj
2014-04-28  2:03   ` Rich Felker
2014-04-28  5:51     ` Khem Raj
2014-04-28 10:11       ` Szabolcs Nagy
2014-04-28 12:22         ` Jens Gustedt
2014-04-28 13:26           ` Szabolcs Nagy
2014-04-28 13:59             ` Jens Gustedt
2014-04-28 14:14             ` Rich Felker [this message]
2014-04-28 14:29 ` [PATCH 1/3] bits/socket.h: Define SO_RCVBUFFORCE for mips Rich Felker
2014-04-28 14:54   ` Khem Raj
2014-04-30 18:48     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140428141420.GW26358@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).