diff options
author | Richard Guenther <rguenther@suse.de> | 2008-08-20 15:58:47 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-08-20 15:58:47 +0000 |
commit | e2104f59c475b30f600bdd812904a508a2d15721 (patch) | |
tree | 261cdcc0eab7aad499e58deaf8abb7f55131cb0c /gcc/tree-ssa-ccp.c | |
parent | 5e5dc75a3ef9ebff03bbf57fc7152e17e2449737 (diff) | |
download | gcc-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.c | 13 |
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; } |