aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.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/tree.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/tree.c')
-rw-r--r--gcc/tree.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index dcbf74d..fef9826 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2466,6 +2466,29 @@ build1 (enum tree_code code, tree type, tree node)
TREE_READONLY (t) = 0;
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:
if (TREE_CODE_CLASS (code) == '1' && node && TREE_CONSTANT (node))
TREE_CONSTANT (t) = 1;