This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
- From: "janis187 at us dot ibm dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jul 2003 23:18:37 -0000
- Subject: [Bug c/11446] [3.4] Incompatibilty with alignment of structures between 3.3 and 3.4 CVS
- References: <20030706185410.11446.aj@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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?