This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] ABI union alignment fix for place_union_field
- From: David Edelsohn <dje at watson dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, Mark Mitchell <mark at codesourcery dot com>
- Date: Sat, 08 Dec 2001 01:26:03 -0500
- Subject: [PATCH] ABI union alignment fix for place_union_field
When stor-layout.c:layout_record() was split into place_field()
and place_union_field(), the ADJUST_FIELD_ALIGN was only kept in one
instance when it should be applied to both records and unions. Without
restoring this fix, GCC is not compatible with the AIX ABI and is not
backward compatible with gcc-2.95.
I would like to apply this to both the trunk and the gcc-3.0
branch.
David
* stor-layout.c (place_union_field): Apply ADJUST_FIELD_ALIGN
to unions.
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stor-layout.c,v
retrieving revision 1.113
diff -c -p -r1.113 stor-layout.c
*** stor-layout.c 2001/12/03 15:22:47 1.113
--- stor-layout.c 2001/12/08 06:17:18
*************** place_union_field (rli, field)
*** 658,663 ****
--- 658,667 ----
MIN (desired_align, (unsigned) BIGGEST_FIELD_ALIGNMENT);
#endif
+ #ifdef ADJUST_FIELD_ALIGN
+ desired_align = ADJUST_FIELD_ALIGN (field, desired_align);
+ #endif
+
TYPE_USER_ALIGN (rli->t) |= DECL_USER_ALIGN (field);
/* Union must be at least as aligned as any field requires. */