]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/39648 (internal compiler error: in fold_convert, at fold-const.c:2506)
authorRichard Biener <rguenth@gcc.gnu.org>
Sun, 5 Apr 2009 19:50:28 +0000 (19:50 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 5 Apr 2009 19:50:28 +0000 (19:50 +0000)
2009-04-05  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/39648
* tree-ssa-sccvn.c (vn_reference_fold_indirect): Work around
our &A vs. &A[0] IL deficiencies.

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

From-SVN: r145569

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

index 74b0f8d88207eb24b87bd782964118b6ce045443..19d3eaacf751cdd3ae200cb11d020e141af77d75 100644 (file)
@@ -1,7 +1,13 @@
+2009-04-05  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39648
+       * tree-ssa-sccvn.c (vn_reference_fold_indirect): Work around
+       our &A vs. &A[0] IL deficiencies.
+
 2009-04-04  Jan Hubicka  <jh@suse.cz>
 
-       * except.c (sjlj_find_directly_reachable_regions): Be ready for removed toplevel
-       regions.
+       * except.c (sjlj_find_directly_reachable_regions): Be ready for
+       removed toplevel regions.
        (sjlj_mark_call_sites): Likewise.
 
 2009-04-04  Dave Korn  <dave.korn.cygwin@gmail.com>
index 7f7c07ef4a9db535a348535055549d8244b9e480..83215bb1d6f00166c24f241660c7950249609b30 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-05  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39648
+       * gcc.c-torture/compile/pr39648.c: New testcase.
+
 2009-04-05  Jason Merrill  <jason@redhat.com>
 
        PR c++/14912
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39648.c b/gcc/testsuite/gcc.c-torture/compile/pr39648.c
new file mode 100644 (file)
index 0000000..bb901fe
--- /dev/null
@@ -0,0 +1,12 @@
+void
+yysyntax_error (char *yyp)
+{
+        char const *yyf;
+        char yyformat[5];
+
+        yyf = yyformat;
+        while ((*yyp = *yyf) != '\0') {
+                if (yyf[1] == 's')
+                        yyf += 2;
+        }
+}
index 729787be3f7078479aa8e3c95799c2fdd6b1bc2c..2982e8ca051ca23e24aca714626941c4fb8c1041 100644 (file)
@@ -757,6 +757,23 @@ vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **ops,
 
   /* Get ops for the addressed object.  */
   op = VEC_index (vn_reference_op_s, *ops, i);
+  /* ???  If this is our usual typeof &ARRAY vs. &ARRAY[0] problem, work
+     around it to avoid later ICEs.  */
+  if (TREE_CODE (TREE_TYPE (TREE_OPERAND (op->op0, 0))) == ARRAY_TYPE
+      && TREE_CODE (TREE_TYPE (TREE_TYPE (op->op0))) != ARRAY_TYPE)
+    {
+      vn_reference_op_s aref;
+      tree dom;
+      aref.type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (op->op0)));
+      aref.opcode = ARRAY_REF;
+      aref.op0 = integer_zero_node;
+      if ((dom = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (op->op0, 0))))
+         && TYPE_MIN_VALUE (dom))
+       aref.op0 = TYPE_MIN_VALUE (dom);
+      aref.op1 = NULL_TREE;
+      aref.op2 = NULL_TREE;
+      VEC_safe_push (vn_reference_op_s, heap, mem, &aref);
+    }
   copy_reference_ops_from_ref (TREE_OPERAND (op->op0, 0), &mem);
 
   /* Do the replacement - we should have at least one op in mem now.  */