aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-08-20 15:58:47 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-08-20 15:58:47 +0000
commite2104f59c475b30f600bdd812904a508a2d15721 (patch)
tree261cdcc0eab7aad499e58deaf8abb7f55131cb0c /gcc/tree-ssa-ccp.c
parent5e5dc75a3ef9ebff03bbf57fc7152e17e2449737 (diff)
downloadgcc-e2104f59c475b30f600bdd812904a508a2d15721.zip
gcc-e2104f59c475b30f600bdd812904a508a2d15721.tar.gz
gcc-e2104f59c475b30f600bdd812904a508a2d15721.tar.bz2
tree-ssa-ccp.c (maybe_fold_stmt_indirect): Do not mess with TREE_THIS_VOLATILE on shared nodes.
2008-08-20 Richard Guenther <rguenther@suse.de> * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Do not mess with TREE_THIS_VOLATILE on shared nodes. (fold_stmt_r): Likewise. * gcc.c-torture/compile/20080820-1.c: New testcase. From-SVN: r139325
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index ad6012e..c89bd2c 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2118,7 +2118,11 @@ maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
TREE_TYPE (expr));
if (t)
{
- TREE_THIS_VOLATILE (t) = volatile_p;
+ /* Preserve volatileness of the original expression.
+ We can end up with a plain decl here which is shared
+ and we shouldn't mess with its flags. */
+ if (!SSA_VAR_P (t))
+ TREE_THIS_VOLATILE (t) = volatile_p;
return t;
}
}
@@ -2404,8 +2408,11 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
if (t)
{
- /* Preserve volatileness of the original expression. */
- TREE_THIS_VOLATILE (t) = volatile_p;
+ /* Preserve volatileness of the original expression.
+ We can end up with a plain decl here which is shared
+ and we shouldn't mess with its flags. */
+ if (!SSA_VAR_P (t))
+ TREE_THIS_VOLATILE (t) = volatile_p;
*expr_p = t;
*changed_p = true;
}