aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-12-05 21:45:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-12-05 21:45:15 +0000
commit39be21dd5aba45b6bbfe159809444d6f2ad614de (patch)
tree560a457c88a46b8a12942c609706fa03abae2aa0
parent60332588d6194a8636748a484f102d8b36eef80d (diff)
downloadgcc-39be21dd5aba45b6bbfe159809444d6f2ad614de.zip
gcc-39be21dd5aba45b6bbfe159809444d6f2ad614de.tar.gz
gcc-39be21dd5aba45b6bbfe159809444d6f2ad614de.tar.bz2
re PR tree-optimization/34138 (verify_ssa failed (found real variable when subvariables should have appeared))
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. From-SVN: r130632
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr34138.c21
-rw-r--r--gcc/tree-ssa-forwprop.c5
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 104b8ea..d257d49 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2007-12-05 Uros Bizjak <ubizjak@gmail.com>
PR target/34312
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0778f07..922d4d6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-05 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/34138
+ * gcc.c-torture/compile/pr34138.c: New testcase.
+
2007-12-05 Jakub Jelinek <jakub@redhat.com>
PR debug/33739
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr34138.c b/gcc/testsuite/gcc.c-torture/compile/pr34138.c
new file mode 100644
index 0000000..85e8863
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr34138.c
@@ -0,0 +1,21 @@
+extern void free (void *__ptr);
+struct shparam
+{
+ char **p;
+ int foo;
+};
+static struct shparam shellparam;
+inline void freeparam (volatile struct shparam *param, char **ap)
+{
+ free ((void *) (*ap));
+ free ((void *) (param->p));
+}
+void dotcmd (char **p)
+{
+ freeparam (&shellparam, p);
+}
+void evaltree (void)
+{
+ void (*evalfn) (char **);
+ evalfn = dotcmd;
+}
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)))))
{