From 3653034006bd6c333929b3a6b51aa94cae36694d Mon Sep 17 00:00:00 2001 From: drow Date: Mon, 19 Apr 2004 18:02:40 +0000 Subject: * stor-layout.c (layout_decl): Check DECL_PACKED before calling ADJUST_FIELD_ALIGN. Check maximum_field_alignment after. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80860 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/stor-layout.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index d19fc9fdf3f..33d0a86e90d 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -512,10 +512,7 @@ layout_decl (tree decl, unsigned int known_align) || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST)) DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); - /* Should this be controlled by DECL_USER_ALIGN, too? */ - if (maximum_field_alignment != 0) - DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment); - if (! DECL_USER_ALIGN (decl)) + if (! DECL_USER_ALIGN (decl) && ! DECL_PACKED (decl)) { /* Some targets (i.e. i386, VMS) limit struct field alignment to a lower boundary than alignment of variables unless @@ -528,6 +525,10 @@ layout_decl (tree decl, unsigned int known_align) DECL_ALIGN (decl) = ADJUST_FIELD_ALIGN (decl, DECL_ALIGN (decl)); #endif } + + /* Should this be controlled by DECL_USER_ALIGN, too? */ + if (maximum_field_alignment != 0) + DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), maximum_field_alignment); } /* Evaluate nonconstant size only once, either now or as soon as safe. */ -- cgit v1.2.1