diff mbox

[Ada] PR target/79749

Message ID 2905915.oz7gs4Bs1q@polaris
State New
Headers show

Commit Message

Eric Botcazou Feb. 28, 2017, 10:20 p.m. UTC
This fixes the wrong code generated at -O0 with -fomit-frame-pointer in cases 
when the leaf function optimization could be applied (but is never at -O0).

Tested on SPARC/Solaris, applied on all active branches.

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  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.target/sparc/20170228-1.c: New test.
diff mbox

Patch

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 245767)
+++ config/sparc/sparc.c	(working copy)
@@ -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