From 39be21dd5aba45b6bbfe159809444d6f2ad614de Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 5 Dec 2007 21:45:15 +0000 Subject: re PR tree-optimization/34138 (verify_ssa failed (found real variable when subvariables should have appeared)) 2007-12-05 Richard Guenther 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. From-SVN: r130632 --- gcc/tree-ssa-forwprop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-forwprop.c') diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index f368c33..2da17c8 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))))) { -- cgit v1.1