public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/9932: alignment of long long in struct seems to be wrong
@ 2003-03-16  8:31 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2003-03-16  8:31 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hagen, nobody

Synopsis: alignment of long long in struct seems to be wrong

State-Changed-From-To: feedback->closed
State-Changed-By: rth
State-Changed-When: Sun Mar 16 08:31:46 2003
State-Changed-Why:
    Not a bug.  The x86 svr4 abi specifies that the maximum alignment
    of data in a structure is 4.  The *preferred* alignment is
    8, so that's what __alignof returns.
    
    There is a modification of this rule for MMX and SSE data
    types, in that they really require 8 and 16 byte alignment
    respectively; in this change we follow the Intel compiler.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9932


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c/9932: alignment of long long in struct seems to be wrong
@ 2003-03-04 18:06 Hagen Last
  0 siblings, 0 replies; 3+ messages in thread
From: Hagen Last @ 2003-03-04 18:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9932; it has been noted by GNATS.

From: Hagen Last <hagen@equator.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,  hagen@equator.com, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c/9932: alignment of long long in struct seems to be wrong
Date: 04 Mar 2003 09:39:11 -0800

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9932
 
 I don't know if there is a formal specification for the correct
 alignment of 64-bit data types on x86 linux. I think that's up to the
 compiler (I was actually told by one of our compiler guys that I should
 not assume anything about alignment of data types).
 
 But from what I understand structs must be aligned to the largest
 alignment of its members. So, if the alignment of a 64-bit type is 8
 (for a specific compiler) then it must also align a struct that has a
 member of this data type to (at least) 8.
 
 Hagen.
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c/9932: alignment of long long in struct seems to be wrong
@ 2003-03-04 15:30 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-03-04 15:30 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hagen, nobody

Old Synopsis: alignment of 64-bit type in struct seems to be wrong
New Synopsis: alignment of long long in struct seems to be wrong

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Tue Mar  4 15:30:49 2003
State-Changed-Why:
    This is indeed weird: 2.95 returns an alignment of 4,
    while subsequent compilers indicate 8 for long long:
    g/x> gcc x.c ; ./a.out
    12 16
    4 8 4
    g/x> /home/bangerth/bin/gcc-3.0.4/bin/gcc x.c ; ./a.out
    12 16
    4 8 8
    g/x>
    g/x>
    g/x> /home/bangerth/bin/gcc-3.2.2-pre/bin/gcc x.c ; ./a.out
    12 16
    4 8 8
    g/x> /home/bangerth/bin/gcc-3.3-pre/bin/gcc x.c ; ./a.out
    12 16
    4 8 8
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc x.c ; ./a.out
    12 16
    4 8 8
    
    icc7 returns 4 as well:
    g/x> icc x.c ; ./a.out
    12 16
    4 8 4
    
    Do you know whether there are formal specifications for
    x86 linux (an ABI) dictating the correct alignment?
    
    Wolfgang

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9932


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-16  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-16  8:31 c/9932: alignment of long long in struct seems to be wrong rth
  -- strict thread matches above, loose matches on Subject: below --
2003-03-04 18:06 Hagen Last
2003-03-04 15:30 bangerth

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 read-only IMAP folder(s) and NNTP newsgroup(s).