aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-10-20 17:57:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-10-20 17:57:29 -0400
commit2038bd6935ac0e660517b1e2bb17f8482210b3fb (patch)
tree3fa7706fb78b0726e4f89cb84adcf0a469b08fc7 /gcc/stor-layout.c
parent02601a5c5a49dfd20f2e34a146fc7b3cc6d3f0df (diff)
downloadgcc-2038bd6935ac0e660517b1e2bb17f8482210b3fb.zip
gcc-2038bd6935ac0e660517b1e2bb17f8482210b3fb.tar.gz
gcc-2038bd6935ac0e660517b1e2bb17f8482210b3fb.tar.bz2
re PR c/12553 ([tree-ssa] ICE in gimplify_expr with volatiles)
PR c/12553 * tree.c (build1) <ADDR_EXPR>: Set TREE_SIDE_EFFECTS appropriately. PR c/11446 * stor-layout.c (layout_decl): Fix alignment handling. From-SVN: r72724
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index dcdca57..c29c22d 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -450,20 +450,26 @@ layout_decl (tree decl, unsigned int known_align)
}
else if (DECL_PACKED (decl) && DECL_USER_ALIGN (decl))
/* Don't touch DECL_ALIGN. For other packed fields, go ahead and
- round up; we'll reduce it again below. */;
+ round up; we'll reduce it again below. We want packing to
+ supercede USER_ALIGN inherited from the type, but defer to
+ alignment explicitly specified on the field decl. */;
else
- do_type_align (type, decl);
-
- /* If the field is of variable size, we can't misalign it since we
- have no way to make a temporary to align the result. But this
- isn't an issue if the decl is not addressable. Likewise if it
- is of unknown size. */
- if (DECL_PACKED (decl)
- && !DECL_USER_ALIGN (decl)
- && (DECL_NONADDRESSABLE_P (decl)
- || DECL_SIZE_UNIT (decl) == 0
- || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
- DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
+ {
+ do_type_align (type, decl);
+
+ /* If the field is of variable size, we can't misalign it since we
+ have no way to make a temporary to align the result. But this
+ isn't an issue if the decl is not addressable. Likewise if it
+ is of unknown size.
+
+ Note that do_type_align may set DECL_USER_ALIGN, so we don't
+ want to check it again here. */
+ if (DECL_PACKED (decl)
+ && (DECL_NONADDRESSABLE_P (decl)
+ || DECL_SIZE_UNIT (decl) == 0
+ || 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)