]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR target/79749
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Feb 2017 22:15:54 +0000 (22:15 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 28 Feb 2017 22:15:54 +0000 (22:15 +0000)
* config/sparc/sparc.c (sparc_frame_pointer_required): Add missing
condition on optimize for the leaf function test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245791 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 54021fb77f9c7abe07a8ef12fea308f5b6f54e03..51cb8abc1d28729c0bab3ed4962eb6cb3f8b60f0 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-28  Martin Liska  <mliska@suse.cz>
 
        PR lto/79625
index b9213c30bcb0e49826f319667bbf7fe4d7bac157..16ca444518f4647bb2280215bc4955d1b4eaca75 100644 (file)
@@ -12180,8 +12180,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 a9ff533fb994689df0e9a55a422076a83653d00f..4aab63a4e5d7f42f4ccf3897f63be979c6cbfaf7 100644 (file)
@@ -1,3 +1,7 @@
+2017-02-28  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.target/sparc/20170228-1.c: New test.
+
 2017-02-28  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/invsize-1.c: 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;
+}