summaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-26 12:58:35 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-26 12:58:35 +0000
commit62df0ff99f2ca79430f3c26c5d2b8fca0ddf9d3a (patch)
tree851dba3ea227d9d83fa999a66f6e3c047a8e9978 /gcc/gimple-fold.c
parentd384d9d9bc27b1a905726591d25e20981f776460 (diff)
downloadgcc-62df0ff99f2ca79430f3c26c5d2b8fca0ddf9d3a.tar.gz
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472 * gimple-fold.c (fold_const_aggregate_ref_1): Do not fold volatile references. * gcc.dg/torture/pr50472.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index b481c4a5fa1..d754ea9a5b9 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2919,6 +2919,9 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
HOST_WIDE_INT offset, size, max_size;
tree tem;
+ if (TREE_THIS_VOLATILE (t))
+ return NULL_TREE;
+
if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_declaration)
return get_symbol_constant_value (t);