]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/39041 (ICE on valid during vrp2)
authorRichard Guenther <rguenther@suse.de>
Fri, 30 Jan 2009 22:14:39 +0000 (22:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 30 Jan 2009 22:14:39 +0000 (22:14 +0000)
2009-01-30  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/39041
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1):
Propagate variable indices only if the types match for this stmt.

* gcc.c-torture/compile/pr39041.c: New testcase.

From-SVN: r143809

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr39041.c [new file with mode: 0644]
gcc/tree-ssa-forwprop.c

index fa6334a7e0811a00c186af3a3b7b5f19c629f1a0..0f79c072dd6dd05d20223b7b379368725ee8c619 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39041
+       * tree-ssa-forwprop.c (forward_propagate_addr_expr_1):
+       Propagate variable indices only if the types match for this stmt.
+
 2009-01-29  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline:
index ee63e611938f1dcb123c4c5a257baa5fa71e6636..fbe3d8a5d9d7d5eb2584db03551cc372ce7340ed 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-30  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39041
+       * gcc.c-torture/compile/pr39041.c: New testcase.
+
 2009-01-30  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39041.c b/gcc/testsuite/gcc.c-torture/compile/pr39041.c
new file mode 100644 (file)
index 0000000..cc58a8a
--- /dev/null
@@ -0,0 +1,28 @@
+int test_bit(int nr, void *addr)
+{
+  int *a = (int *)addr;
+  int mask;
+  a += nr;
+  mask = 1 << nr;
+  return mask & *a;
+}
+struct {
+    struct {
+       int disabled;
+    } *data[1];
+} trace;
+struct {
+    unsigned bits[1];
+} cpumask;
+void inc(int *);
+void dec(int *);
+int foo(void)
+{
+  int cpu;
+  for (cpu = 0; cpu < 1; cpu++) {
+      if (test_bit(cpu, cpumask.bits))
+       inc(&trace.data[cpu]->disabled);
+      if (!test_bit(cpu, cpumask.bits))
+       dec(&trace.data[cpu]->disabled);
+  }
+}
index 1b901f1b2678d0806e0eb7a03b4b8ec62b4a63ff..c0e0cf800d3e4828610376f7ca5958f51fe29ff1 100644 (file)
@@ -677,6 +677,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
      array elements, then the result is converted into the proper
      type for the arithmetic.  */
   if (TREE_CODE (TREE_OPERAND (rhs, 1)) == SSA_NAME
+      && useless_type_conversion_p (TREE_TYPE (name), TREE_TYPE (def_rhs))
       /* Avoid problems with IVopts creating PLUS_EXPRs with a
         different type than their operands.  */
       && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (name)))