]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/79749 (Many sparc testcases FAIL at -O0 with -fomit-frame-pointer)
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 28 Feb 2017 22:19:56 +0000 (22:19 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 28 Feb 2017 22:19:56 +0000 (22:19 +0000)
PR target/79749
* config/sparc/sparc.c (sparc_frame_pointer_required): Add missing
condition on optimize for the leaf function test.

From-SVN: r245793

gcc/ChangeLog
gcc/config/sparc/sparc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sparc/20170228-1.c [new file with mode: 0644]

index 1c1fec575ce4090f033751172b814e4ab2d4c510..134d03a839e9173777282244238883b13ef07d48 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-28  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR target/79749
+       * config/sparc/sparc.c (sparc_frame_pointer_required): Add missing
+       condition on optimize for the leaf function test.
+
 2017-02-22  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline
index 5e4405456182bb55b4beef97782cc749a285b989..18bacf27df7833502ada73b1ed349868a9e9a979 100644 (file)
@@ -11989,8 +11989,9 @@ sparc_frame_pointer_required (void)
   if (TARGET_FLAT)
     return false;
 
-  /* Otherwise, the frame pointer is required if the function isn't leaf.  */
-  return !(crtl->is_leaf && only_leaf_regs_used ());
+  /* Otherwise, the frame pointer is required if the function isn't leaf, but
+     we cannot use sparc_leaf_function_p since it hasn't been computed yet.  */
+  return !(optimize > 0 && crtl->is_leaf && only_leaf_regs_used ());
 }
 
 /* The way this is structured, we can't eliminate SFP in favor of SP
index fe526b4df404d2ddfa4f292f5f02a69d29e67e73..cca71f0fa54af568a5ce1ffa04e58e1624c32a2b 100644 (file)
@@ -1,3 +1,7 @@
+2017-02-28  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.target/sparc/20170228-1.c: New test.
+
 2017-02-24  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/opt63.adb: New test.
diff --git a/gcc/testsuite/gcc.target/sparc/20170228-1.c b/gcc/testsuite/gcc.target/sparc/20170228-1.c
new file mode 100644 (file)
index 0000000..575fbce
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR target/79749 */
+/* Reported by Rainer Orth <ro@gcc.gnu.org> */
+
+/* { dg-do run } */
+/* { dg-options "-fomit-frame-pointer" } */
+
+extern void abort (void);
+
+int foo (int x1, int x2, int x3, int x4, int x5, int x6, int x7)
+{
+  return x7;
+}
+
+int main (void)
+{
+  if (foo (100, 200, 300, 400, 500, 600, 700) != 700)
+    abort ();
+
+  return 0;
+}