re PR middle-end/27942 (packed union doesn't make the unaligned magic on sh64-*)

PR middle-end/27942
	* stor-layout.c (update_alignment_for_field): Don't add extra
	alignment for packed non-bitfield fields in ms_bitfield_layout_p
	code.

	* gcc.dg/attr-ms_struct-packed1.c: New.

From-SVN: r114552
This commit is contained in:
Kaz Kojima 2006-06-11 23:09:58 +00:00
parent 9b317af39e
commit cb3123765e
4 changed files with 37 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2006-06-11 Kaz Kojima <kkojima@gcc.gnu.org>
PR middle-end/27942
* stor-layout.c (update_alignment_for_field): Don't add extra
alignment for packed non-bitfield fields in ms_bitfield_layout_p
code.
2006-06-09 Ralf Corsepius <ralf.corsepius@rtems.org>
* config/mips/t-rtems: Add EL/EB multilib variants.

View File

@ -693,7 +693,7 @@ update_alignment_for_field (record_layout_info rli, tree field,
the type, except that for zero-size bitfields this only
applies if there was an immediately prior, nonzero-size
bitfield. (That's the way it is, experimentally.) */
if (!is_bitfield
if ((!is_bitfield && !DECL_PACKED (field))
|| (!integer_zerop (DECL_SIZE (field))
? !DECL_PACKED (field)
: (rli->prev_field

View File

@ -1,3 +1,7 @@
2006-06-11 Kaz Kojima <kkojima@gcc.gnu.org>
* gcc.dg/attr-ms_struct-packed1.c: New.
2006-06-09 Mike Stump <mrs@apple.com>
* gcc.dg/vla-7.c: Add.

View File

@ -0,0 +1,25 @@
/* Test for MS structure with packed attribute. */
/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-darwin* } }
/* { dg-options "-std=gnu99" } */
extern void abort ();
union u
{
int a;
} __attribute__((__ms_struct__, __packed__));
struct s
{
char c;
union u u;
};
int
main (void)
{
if (sizeof (struct s) != (sizeof (char) + sizeof (union u)))
abort ();
return 0;
}