public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
@ 2003-07-06 18:54 aj at gcc dot gnu dot org
2003-07-06 18:55 ` [Bug c/11446] [3.4] " aj at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: aj at gcc dot gnu dot org @ 2003-07-06 18:54 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
Summary: Incompatibilty with alignment of structures between 3.3
and 3.4 CVS
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: aj at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-linux-gnu
GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu
On i686-linux-gnu the struct-align-1
testcase fails if I mix objects from GCC 3.3 and GCC 3.4 using current
CVS versions, the testsuite reports:
FAIL: gcc.dg/compat/struct-align-1 c_compat_x_tst.o-c_compat_y_alt.o execute
FAIL: gcc.dg/compat/struct-align-1 c_compat_x_alt.o-c_compat_y_tst.o execute
Here's an example compile session:
$ /opt/gcc/3.3-devel/bin/gcc -c -DDBG struct-align-1_x.c
$ /opt/gcc/3.4-devel/bin/gcc -c -DDBG struct-align-1_y.c
$ /opt/gcc/3.4-devel/bin/gcc -c -DDBG struct-align-1_main.c
$ /opt/gcc/3.4-devel/bin/gcc -DDBG *.o -o struct-align-1
$ ./struct-align-1
original
global variable.......
global array.......
argument.......
function result.......
packed attribute for all
global variable.......
global array.......
argument.......
function result.......
packed attribute for inner
global variable.......
global array.......
argument.......
function result.......
packed attribute for outer
global variable.......
global array.......
argument.......
function result.......
maximum useful struct alignment for all
global variable.......
global array.......
argument.......
function result.......
maximum alignment for outer, packed inner
global variable.......
global array.......
argument.......
function result.......
maximum alignment for inner, packed outer
global variable...F.FF
global array..FFFFF
argument...F.FF
function result...F.FF
failed
Aborted
gromit:~/tmp/align-1:[134]$
The structure that fails is:
#define DESC_m_inner_p_outer "maximum alignment for inner, packed outer"
struct B1_m_inner_p_outer {
char c;
double d;
} __attribute__ ((aligned)) __attribute__ ((packed));
A diff between struct_align-1_x.s between GCC 3.3 and 3.4 shows:
.globl b2_a_max
- .align 32
+ .align 16
...
.globl b2_m_inner_p_outer
+ .align 16
.type b2_m_inner_p_outer, @object
- .size b2_m_inner_p_outer, 17
+ .size b2_m_inner_p_outer, 32
...
.globl ab2_m_inner_p_outer
- .align 32
+ .align 16
.type ab2_m_inner_p_outer, @object
- .size ab2_m_inner_p_outer, 34
+ .size ab2_m_inner_p_outer, 64
So, we have different alignment and therefore sizes. :-(
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
@ 2003-07-06 18:55 ` aj at gcc dot gnu dot org
2003-07-06 19:04 ` pinskia at physics dot uc dot edu
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: aj at gcc dot gnu dot org @ 2003-07-06 18:55 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
aj at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-07-06 18:55:40
date| |
Summary|Incompatibilty with |[3.4] Incompatibilty with
|alignment of structures |alignment of structures
|between 3.3 and 3.4 CVS |between 3.3 and 3.4 CVS
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
2003-07-06 18:55 ` [Bug c/11446] [3.4] " aj at gcc dot gnu dot org
@ 2003-07-06 19:04 ` pinskia at physics dot uc dot edu
2003-07-18 22:32 ` dhazeghi at yahoo dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-06 19:04 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-06 19:04 -------
Please do not confirm your own bug.
I can confirm this on the mainline (20030706) and 3.3.1 (20030616), the difference is there.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
2003-07-06 18:55 ` [Bug c/11446] [3.4] " aj at gcc dot gnu dot org
2003-07-06 19:04 ` pinskia at physics dot uc dot edu
@ 2003-07-18 22:32 ` dhazeghi at yahoo dot com
2003-07-29 12:37 ` pinskia at physics dot uc dot edu
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-07-18 22:32 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
dhazeghi at yahoo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
------- Additional Comments From dhazeghi at yahoo dot com 2003-07-18 22:32 -------
Which layout is correct though?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (2 preceding siblings ...)
2003-07-18 22:32 ` dhazeghi at yahoo dot com
@ 2003-07-29 12:37 ` pinskia at physics dot uc dot edu
2003-07-31 23:18 ` janis187 at us dot ibm dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-07-29 12:37 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (3 preceding siblings ...)
2003-07-29 12:37 ` pinskia at physics dot uc dot edu
@ 2003-07-31 23:18 ` janis187 at us dot ibm dot com
2003-08-29 20:50 ` [Bug c/11446] [3.4][3.4 regression?] " jason at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-07-31 23:18 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
janis187 at us dot ibm dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at redhat dot com
------- Additional Comments From janis187 at us dot ibm dot com 2003-07-31 23:18 -------
The sizes and alignments of the structs in PR 11446 changed with this
patch:
--- gcc/gcc/ChangeLog ---
2003-04-03 Jason Merrill <jason@redhat.com>
* stor-layout.c (do_type_align): New fn, split out from...
(layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
* tree.h (struct record_layout_info_s): Remove unpadded_align.
* c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
or DECL_MODE on the CONST_DECLs.
(finish_struct): Don't mess with DECL_ALIGN.
--- gcc/gcc/cp/ChangeLog ---
2003-04-03 Jason Merrill <jason@redhat.com>
* class.c (build_vtable): Set DECL_ALIGN here.
(get_vtable_decl): Not here.
(layout_vtable_decl): Or here.
(create_vtable_ptr): Or here.
(layout_class_type): Or here.
(check_bitfield_decl): Don't mess with field alignment.
I used the following test on i686-pc-linux-gnu and watched for the size
of b2 to become 32:
------------------------------------------------------------------
struct A2_m_inner_p_outer {
double d;
} __attribute__ ((aligned));
struct B2_m_inner_p_outer {
char c;
struct A2_m_inner_p_outer a2;
} __attribute__ ((packed));
struct B2_m_inner_p_outer b2 = { 1, { 2.0 } };
struct B2_m_inner_p_outer a2[2] = { { 1, { 2.0 } }, { 2, { 3.0 } } };
------------------------------------------------------------------
Here's the definition of b2 before and after the patch:
.globl b2
.data
+ .align 16
.type b2, @object
- .size b2, 17
+ .size b2, 32
b2:
.byte 1
+ .zero 15
.long 0
.long 1073741824
.zero 8
I don't know what the expected sizes and alignments are; Jason, is this
change expected?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4][3.4 regression?] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (4 preceding siblings ...)
2003-07-31 23:18 ` janis187 at us dot ibm dot com
@ 2003-08-29 20:50 ` jason at gcc dot gnu dot org
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu dot org @ 2003-08-29 20:50 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4][3.4 regression?] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (6 preceding siblings ...)
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
@ 2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
2003-10-20 22:29 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-10-20 22:02 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-10-20 22:02 -------
Subject: Bug 11446
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jason@gcc.gnu.org 2003-10-20 22:01:59
Added files:
gcc/testsuite/gcc.dg: pack-test-5.c
Log message:
PR c/11446
* stor-layout.c (layout_decl): Fix alignment handling.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pack-test-5.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4][3.4 regression?] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (5 preceding siblings ...)
2003-08-29 20:50 ` [Bug c/11446] [3.4][3.4 regression?] " jason at gcc dot gnu dot org
@ 2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
2003-10-20 22:29 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-10-20 22:02 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-10-20 21:57 -------
Subject: Bug 11446
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jason@gcc.gnu.org 2003-10-20 21:57:42
Modified files:
gcc : tree.c stor-layout.c ChangeLog
Log message:
PR c/12553
* tree.c (build1) <ADDR_EXPR>: Set TREE_SIDE_EFFECTS
appropriately.
PR c/11446
* stor-layout.c (layout_decl): Fix alignment handling.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.333&r2=1.334
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&r1=1.170&r2=1.171
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1492&r2=2.1493
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/11446] [3.4][3.4 regression?] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
` (7 preceding siblings ...)
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
@ 2003-10-20 22:29 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-20 22:29 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11446
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-20 22:28 -------
Fixed for 3.4.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-10-20 22:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-06 18:54 [Bug c/11446] New: Incompatibilty with alignment of structures between 3.3 and 3.4 CVS aj at gcc dot gnu dot org
2003-07-06 18:55 ` [Bug c/11446] [3.4] " aj at gcc dot gnu dot org
2003-07-06 19:04 ` pinskia at physics dot uc dot edu
2003-07-18 22:32 ` dhazeghi at yahoo dot com
2003-07-29 12:37 ` pinskia at physics dot uc dot edu
2003-07-31 23:18 ` janis187 at us dot ibm dot com
2003-08-29 20:50 ` [Bug c/11446] [3.4][3.4 regression?] " jason at gcc dot gnu dot org
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
2003-10-20 22:02 ` cvs-commit at gcc dot gnu dot org
2003-10-20 22:29 ` pinskia 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).