summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-05 21:45:15 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-12-05 21:45:15 +0000
commitd9d723d91ff90f13e0162307658b2cb9e92d6dff (patch)
tree560a457c88a46b8a12942c609706fa03abae2aa0 /gcc/tree-ssa-forwprop.c
parent68685205020781b84a8bccca470b36443e963c08 (diff)
downloadgcc-d9d723d91ff90f13e0162307658b2cb9e92d6dff.tar.gz
2007-12-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34138 * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Do not forward propagate addresses if that changes volatileness of the pointed-to type. * gcc.c-torture/compile/pr34138.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130632 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index f368c3321c4..2da17c8827d 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -956,12 +956,15 @@ tree_ssa_forward_propagate_single_use_vars (void)
}
if (TREE_CODE (rhs) == ADDR_EXPR
- /* We can also disregard changes in CV qualifiers for
+ /* We can also disregard changes in const qualifiers for
the dereferenced value. */
|| ((TREE_CODE (rhs) == NOP_EXPR
|| TREE_CODE (rhs) == CONVERT_EXPR)
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
&& POINTER_TYPE_P (TREE_TYPE (rhs))
+ /* But do not propagate changes in volatileness. */
+ && (TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (rhs)))
+ == TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0)))))
&& types_compatible_p (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))),
TREE_TYPE (TREE_TYPE (rhs)))))
{