public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
[not found] <bug-23071-6809@http.gcc.gnu.org/bugzilla/>
@ 2010-03-22 23:13 ` mrs at gcc dot gnu dot org
2010-03-22 23:18 ` mikestump at comcast dot net
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: mrs at gcc dot gnu dot org @ 2010-03-22 23:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from mrs at gcc dot gnu dot org 2010-03-22 23:13 -------
Subject: Bug 23071
Author: mrs
Date: Mon Mar 22 23:13:10 2010
New Revision: 157654
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157654
Log:
PR target/23071
* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
Don't overly align based upon packed packed fields.
Added:
trunk/gcc/testsuite/gcc.target/powerpc/darwin-abi-12.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/rs6000/rs6000.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
[not found] <bug-23071-6809@http.gcc.gnu.org/bugzilla/>
2010-03-22 23:13 ` [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct mrs at gcc dot gnu dot org
@ 2010-03-22 23:18 ` mikestump at comcast dot net
2010-03-22 23:21 ` mrs at gcc dot gnu dot org
2010-03-22 23:24 ` mrs at gcc dot gnu dot org
3 siblings, 0 replies; 11+ messages in thread
From: mikestump at comcast dot net @ 2010-03-22 23:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from mikestump at comcast dot net 2010-03-22 23:18 -------
The previous behavior was fairly broken, adding packed, _increased_ the
alignment. A user that adds packing, never wants more alignment:
struct Test {
double D __attribute__((packed,aligned(4)));
short X;
} x;
struct {
char x;
struct Test t;
} b = { 1, { 2, 3}};
compared to:
struct Test {
double D /* __attribute__((packed,aligned(4))) */;
short X;
} x;
struct {
char x;
struct Test t;
} b = { 1, { 2, 3}};
--
mikestump at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikestump at comcast dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
[not found] <bug-23071-6809@http.gcc.gnu.org/bugzilla/>
2010-03-22 23:13 ` [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct mrs at gcc dot gnu dot org
2010-03-22 23:18 ` mikestump at comcast dot net
@ 2010-03-22 23:21 ` mrs at gcc dot gnu dot org
2010-03-22 23:24 ` mrs at gcc dot gnu dot org
3 siblings, 0 replies; 11+ messages in thread
From: mrs at gcc dot gnu dot org @ 2010-03-22 23:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from mrs at gcc dot gnu dot org 2010-03-22 23:21 -------
This has now been fixed.
--
mrs at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
[not found] <bug-23071-6809@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2010-03-22 23:21 ` mrs at gcc dot gnu dot org
@ 2010-03-22 23:24 ` mrs at gcc dot gnu dot org
3 siblings, 0 replies; 11+ messages in thread
From: mrs at gcc dot gnu dot org @ 2010-03-22 23:24 UTC (permalink / raw)
To: gcc-bugs
--
mrs at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
` (5 preceding siblings ...)
2005-07-26 17:02 ` dje at gcc dot gnu dot org
@ 2005-07-26 17:03 ` dje at gcc dot gnu dot org
6 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-07-26 17:03 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|dje at watson dot ibm dot |unassigned at gcc dot gnu
|com |dot org
Status|UNCONFIRMED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
` (3 preceding siblings ...)
2005-07-26 16:58 ` ian at airs dot com
@ 2005-07-26 17:02 ` dje at watson dot ibm dot com
2005-07-26 17:02 ` dje at gcc dot gnu dot org
2005-07-26 17:03 ` dje at gcc dot gnu dot org
6 siblings, 0 replies; 11+ messages in thread
From: dje at watson dot ibm dot com @ 2005-07-26 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at watson dot ibm dot com 2005-07-26 16:58 -------
Subject: Re: Darwin alignment ignores "attribute packed" for first 'double' element of a struct
If Chris and Apple want to change the behavior for Darwin, be my
guest.
David
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
` (4 preceding siblings ...)
2005-07-26 17:02 ` dje at watson dot ibm dot com
@ 2005-07-26 17:02 ` dje at gcc dot gnu dot org
2005-07-26 17:03 ` dje at gcc dot gnu dot org
6 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-07-26 17:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2005-07-26 17:02 -------
reopen
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|WONTFIX |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
` (2 preceding siblings ...)
2005-07-26 16:28 ` sabre at nondot dot org
@ 2005-07-26 16:58 ` ian at airs dot com
2005-07-26 17:02 ` dje at watson dot ibm dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2005-07-26 16:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ian at airs dot com 2005-07-26 16:55 -------
The whole point of attribute ((packed)) is to change the ABI. If it can't
change the ABI, it is meaningless. So I don't find the argument based on the
ABI to be particularly convincing.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
2005-07-26 13:21 ` [Bug target/23071] " pinskia at gcc dot gnu dot org
2005-07-26 14:27 ` dje at gcc dot gnu dot org
@ 2005-07-26 16:28 ` sabre at nondot dot org
2005-07-26 16:58 ` ian at airs dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: sabre at nondot dot org @ 2005-07-26 16:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sabre at nondot dot org 2005-07-26 16:25 -------
Okay, in that case, how does one change the alignment of the structure? The only way I'm aware of to
do this is with attribute packed, but that will also modify the inter-field padding of the structure. For
example, in this case:
struct Test {
double D __attribute__((packed,aligned(4)));
short X;
int Y;
short Z;
} __attribute__((packed,aligned(4)));
Not only is the alignment of the structure reduced to 4 bytes, the structure is also packed, resulting in
the 'int' being unaligned and the size of the structure being 16 bytes (instead of 20).
"it sure would be nice if you could use 'attribute aligned' to reduce alignment without attribute packed"
-Chris
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
2005-07-26 13:21 ` [Bug target/23071] " pinskia at gcc dot gnu dot org
@ 2005-07-26 14:27 ` dje at gcc dot gnu dot org
2005-07-26 16:28 ` sabre at nondot dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-07-26 14:27 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dje at gcc dot gnu dot org 2005-07-26 14:08 -------
The ABI specifies the alignment of the entire record is doubleword if the
first field is an FP double, regardless of the alignment of the type itself.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
@ 2005-07-26 13:21 ` pinskia at gcc dot gnu dot org
2005-07-26 14:27 ` dje at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-26 13:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-26 13:21 -------
I still don't believe this is a bug.
As the alignment of whole struct is still 8 as double is first, even if the alignment of that double is 4.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
GCC host triplet|powerpc-darwin-* |
GCC target triplet| |powerpc-darwin, powerpc-aix
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23071
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-03-22 23:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-23071-6809@http.gcc.gnu.org/bugzilla/>
2010-03-22 23:13 ` [Bug target/23071] Darwin alignment ignores "attribute packed" for first 'double' element of a struct mrs at gcc dot gnu dot org
2010-03-22 23:18 ` mikestump at comcast dot net
2010-03-22 23:21 ` mrs at gcc dot gnu dot org
2010-03-22 23:24 ` mrs at gcc dot gnu dot org
2005-07-26 7:07 [Bug target/23071] New: " sabre at nondot dot org
2005-07-26 13:21 ` [Bug target/23071] " pinskia at gcc dot gnu dot org
2005-07-26 14:27 ` dje at gcc dot gnu dot org
2005-07-26 16:28 ` sabre at nondot dot org
2005-07-26 16:58 ` ian at airs dot com
2005-07-26 17:02 ` dje at watson dot ibm dot com
2005-07-26 17:02 ` dje at gcc dot gnu dot org
2005-07-26 17:03 ` dje at gcc dot gnu dot org
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).