OSDN Git Service

2013-08-13 Marek Polacek <polacek@redhat.com>
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Aug 2013 13:42:28 +0000 (13:42 +0000)
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 13 Aug 2013 13:42:28 +0000 (13:42 +0000)
    Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/57980
* tree-tailcall.c (process_assignment): Return false
when not dealing with integers or floats.

* gcc.dg/pr57980.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@201688 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b81c9d6..0479d72 100644 (file)
@@ -1,3 +1,13 @@
+2013-08-13  Marek Polacek  <polacek@redhat.com>
+
+       Backport from 4.8:
+       2013-0813  Marek Polacek  <polacek@redhat.com>
+                  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/57980
+       * tree-tailcall.c (process_assignment): Return false
+       when not dealing with integers or floats.
+
 2013-08-12  David Edelsohn  <dje.gcc@gmail.com>
 
        Backport from mainline
index 302cc20..39178c0 100644 (file)
@@ -1,3 +1,11 @@
+2013-08-13  Marek Polacek  <polacek@redhat.com>
+
+       Backport from 4.8:
+       2013-08-13  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/57980
+       * gcc.dg/pr57980.c: New test.
+
 2013-08-11  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from trunk:
diff --git a/gcc/testsuite/gcc.dg/pr57980.c b/gcc/testsuite/gcc.dg/pr57980.c
new file mode 100644 (file)
index 0000000..be83536
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR tree-optimization/57980 */
+/* { dg-do compile } */
+/* { dg-options "-O -foptimize-sibling-calls -w" } */
+
+typedef int V __attribute__ ((vector_size (2 * sizeof (int))));
+extern V f (void);
+
+V
+bar (void)
+{
+  return -f ();
+}
+
+V
+foo (void)
+{
+  V v = { };
+  return v - f ();
+}
index 66fb892..f07297e 100644 (file)
@@ -329,8 +329,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
     case NEGATE_EXPR:
       if (FLOAT_TYPE_P (TREE_TYPE (op0)))
         *m = build_real (TREE_TYPE (op0), dconstm1);
-      else
+      else if (INTEGRAL_TYPE_P (TREE_TYPE (op0)))
         *m = build_int_cst (TREE_TYPE (op0), -1);
+      else
+        return false;
 
       *ass_var = dest;
       return true;
@@ -342,8 +344,10 @@ process_assignment (gimple stmt, gimple_stmt_iterator call, tree *m,
         {
           if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var)))
             *m = build_real (TREE_TYPE (non_ass_var), dconstm1);
-          else
+          else if (INTEGRAL_TYPE_P (TREE_TYPE (non_ass_var)))
             *m = build_int_cst (TREE_TYPE (non_ass_var), -1);
+         else
+           return false;
 
           *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var);
         }