Commit 2038bd69 by Jason Merrill Committed by Jason Merrill

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
parent 02601a5c
2003-10-20 Jason Merrill <jason@redhat.com>
PR c/12553
* tree.c (build1) <ADDR_EXPR>: Set TREE_SIDE_EFFECTS
appropriately.
PR c/11446
* stor-layout.c (layout_decl): Fix alignment handling.
2003-10-20 Joseph S. Myers <jsm@polyomino.org.uk> 2003-10-20 Joseph S. Myers <jsm@polyomino.org.uk>
* doc/extend.texi: Deprecate casts as lvalues. * doc/extend.texi: Deprecate casts as lvalues.
......
...@@ -450,20 +450,26 @@ layout_decl (tree decl, unsigned int known_align) ...@@ -450,20 +450,26 @@ layout_decl (tree decl, unsigned int known_align)
} }
else if (DECL_PACKED (decl) && DECL_USER_ALIGN (decl)) else if (DECL_PACKED (decl) && DECL_USER_ALIGN (decl))
/* Don't touch DECL_ALIGN. For other packed fields, go ahead and /* 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 else
{
do_type_align (type, decl); do_type_align (type, decl);
/* If the field is of variable size, we can't misalign it since we /* 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 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 isn't an issue if the decl is not addressable. Likewise if it
is of unknown size. */ 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) if (DECL_PACKED (decl)
&& !DECL_USER_ALIGN (decl)
&& (DECL_NONADDRESSABLE_P (decl) && (DECL_NONADDRESSABLE_P (decl)
|| DECL_SIZE_UNIT (decl) == 0 || DECL_SIZE_UNIT (decl) == 0
|| TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST)) || TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST))
DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT); DECL_ALIGN (decl) = MIN (DECL_ALIGN (decl), BITS_PER_UNIT);
}
/* Should this be controlled by DECL_USER_ALIGN, too? */ /* Should this be controlled by DECL_USER_ALIGN, too? */
if (maximum_field_alignment != 0) if (maximum_field_alignment != 0)
......
...@@ -2466,6 +2466,29 @@ build1 (enum tree_code code, tree type, tree node) ...@@ -2466,6 +2466,29 @@ build1 (enum tree_code code, tree type, tree node)
TREE_READONLY (t) = 0; TREE_READONLY (t) = 0;
break; break;
case ADDR_EXPR:
if (node)
{
/* The address of a volatile decl or reference does not have
side-effects. But be careful not to ignore side-effects from
other sources deeper in the expression--if node is a _REF and
one of its operands has side-effects, so do we. */
if (TREE_THIS_VOLATILE (node))
{
TREE_SIDE_EFFECTS (t) = 0;
if (!DECL_P (node))
{
int i = first_rtl_op (TREE_CODE (node));
for (; i >= 0; --i)
{
if (TREE_SIDE_EFFECTS (TREE_OPERAND (node, i)))
TREE_SIDE_EFFECTS (t) = 1;
}
}
}
}
break;
default: default:
if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node)) if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node))
TREE_CONSTANT (t) = 1; TREE_CONSTANT (t) = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment