re PR target/23071 (Darwin alignment ignores "attribute packed" for first 'double' element of a struct)

PR target/23071
	* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
	Don't overly align based upon packed packed fields.

From-SVN: r157654
This commit is contained in:
Mike Stump 2010-03-22 23:13:10 +00:00 committed by Mike Stump
parent cc72bbaac7
commit 212066e660
3 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2010-03-22 Mike Stump <mikestump@comcast.net>
PR target/23071
* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
Don't overly align based upon packed packed fields.
2010-03-22 Jason Merrill <jason@redhat.com>
* c-pretty-print.c (pp_c_specifier_qualifier_list) [VECTOR_TYPE]:

View File

@ -4653,6 +4653,9 @@ darwin_rs6000_special_round_type_align (tree type, unsigned int computed,
field = TREE_CHAIN (field);
if (! field)
break;
/* A packed field does not contribute any extra alignment. */
if (DECL_PACKED (field))
return align;
type = TREE_TYPE (field);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);

View File

@ -0,0 +1,14 @@
/* { dg-do compile { target powerpc*-*-darwin* } } */
/* { dg-final { scan-assembler ".comm _x,12,2" } } */
/* { dg-final { scan-assembler-not ".space 7" } } */
/* PR 23071 */
struct Test {
double D __attribute__((packed,aligned(4)));
short X;
} x;
struct {
char x;
struct Test t;
} b = { 1, { 2, 3 } };