re PR tree-optimization/54877 (ICE: tree check: expected ssa_name, have real_cst...
authorJakub Jelinek <jakub@redhat.com>
Wed, 10 Oct 2012 17:47:05 +0000 (19:47 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 10 Oct 2012 17:47:05 +0000 (19:47 +0200)
PR tree-optimization/54877
* tree-vect-loop.c (vect_is_simple_reduction_1): For MINUS_EXPR
use make_ssa_name instead of copy_ssa_name.

* gcc.dg/torture/pr54877.c: New test.

From-SVN: r192322

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr54877.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index dfe39b431f47fd21a81d4cf0b930847e231e861b..b2a05a935d8d2bc10bd0864a3a8cd6e5b2e67443 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/54877
+       * tree-vect-loop.c (vect_is_simple_reduction_1): For MINUS_EXPR
+       use make_ssa_name instead of copy_ssa_name.
+
 2012-10-10  Richard Biener  <rguenther@suse.de>
 
        * lto-streamer-in.c (lto_input_location_bitpack): Rename to ...
index c2e2f5b8d0ea87d2e15774b3fe906a1286767ddb..009aab8a01bbbd8d93efc3aade95325d6d19c8b7 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/54877
+       * gcc.dg/torture/pr54877.c: New test.
+
 2012-10-10  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>
 
        PR testsuite/53397
diff --git a/gcc/testsuite/gcc.dg/torture/pr54877.c b/gcc/testsuite/gcc.dg/torture/pr54877.c
new file mode 100644 (file)
index 0000000..cee406e
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR tree-optimization/54877 */
+/* { dg-do run } */
+/* { dg-options "-ffast-math" } */
+
+extern void abort (void);
+
+int
+foo (void)
+{
+  double d;
+  int i;
+  for (i = 0, d = 0; i < 64; i++)
+    d--;
+  return (int) d;
+}
+
+int
+main ()
+{
+  if (foo () != -64)
+    abort ();
+  return 0;
+}
index 58edfcbe48029c21dec340fce30fc50918b7aaf2..6b8ba3f70916db0e23e1f9447aa787817484ed30 100644 (file)
@@ -2382,7 +2382,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
   if (orig_code == MINUS_EXPR)
     {
       tree rhs = gimple_assign_rhs2 (def_stmt);
-      tree negrhs = copy_ssa_name (rhs, NULL);
+      tree negrhs = make_ssa_name (TREE_TYPE (rhs), NULL);
       gimple negate_stmt = gimple_build_assign_with_ops (NEGATE_EXPR, negrhs,
                                                         rhs, NULL);
       gimple_stmt_iterator gsi = gsi_for_stmt (def_stmt);