re PR tree-optimization/57980 (gcc 4.8.1 -foptimize-sibling-calls -O1 ICE in build_in...
authorMarek Polacek <polacek@redhat.com>
Mon, 12 Aug 2013 08:46:41 +0000 (08:46 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 12 Aug 2013 08:46:41 +0000 (08:46 +0000)
PR tree-optimization/57980

Co-Authored-By: Marc Glisse <marc.glisse@inria.fr>
From-SVN: r201660

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr57980.c [new file with mode: 0644]
gcc/tree-tailcall.c

index 09899f3..cda36e7 100644 (file)
@@ -1,3 +1,10 @@
+2013-08-12  Marek Polacek  <polacek@redhat.com>
+           Marc Glisse  <marc.glisse@inria.fr>
+
+       PR tree-optimization/57980
+       * tree-tailcall.c (process_assignment): Call build_minus_one_cst
+       when creating -1 constant.
+
 2013-08-10  Jan Hubicka  <jh@suse.cz>
 
        Workaround binutils PR14342.
index 3ff0e58..4f0e3f1 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-12  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/57980
+       * gcc.dg/pr57980.c: New test.
+
 2013-08-12  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/56666
diff --git a/gcc/testsuite/gcc.dg/pr57980.c b/gcc/testsuite/gcc.dg/pr57980.c
new file mode 100644 (file)
index 0000000..682f0f4
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR tree-optimization/57980 */
+/* { dg-do compile } */
+/* { dg-options "-O -foptimize-sibling-calls" } */
+
+typedef int V __attribute__ ((vector_size (sizeof (int))));
+extern V f (void);
+
+V
+bar (void)
+{
+  return -f ();
+}
+
+V
+foo (void)
+{
+  V v = { };
+  return v - f ();
+}
index 8cd7255..c9716e7 100644 (file)
@@ -326,11 +326,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
       return true;
 
     case NEGATE_EXPR:
-      if (FLOAT_TYPE_P (TREE_TYPE (op0)))
-        *m = build_real (TREE_TYPE (op0), dconstm1);
-      else
-        *m = build_int_cst (TREE_TYPE (op0), -1);
-
+      *m = build_minus_one_cst (TREE_TYPE (op0));
       *ass_var = dest;
       return true;
 
@@ -339,11 +335,7 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
         *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var);
       else
         {
-          if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var)))
-            *m = build_real (TREE_TYPE (non_ass_var), dconstm1);
-          else
-            *m = build_int_cst (TREE_TYPE (non_ass_var), -1);
-
+         *m = build_minus_one_cst (TREE_TYPE (non_ass_var));
           *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var);
         }