From: Eric Botcazou Date: Tue, 28 Feb 2017 22:19:56 +0000 (+0000) Subject: re PR target/79749 (Many sparc testcases FAIL at -O0 with -fomit-frame-pointer) X-Git-Tag: releases/gcc-5.5.0~497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63d1bb64aaf09248ac6f27af86df452ee119e23e;p=thirdparty%2Fgcc.git re PR target/79749 (Many sparc testcases FAIL at -O0 with -fomit-frame-pointer) PR target/79749 * config/sparc/sparc.c (sparc_frame_pointer_required): Add missing condition on optimize for the leaf function test. From-SVN: r245793 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c1fec575ce4..134d03a839e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-02-28 Eric Botcazou + + 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 Backport from mainline diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 5e4405456182..18bacf27df78 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe526b4df404..cca71f0fa54a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-02-28 Eric Botcazou + + * gcc.target/sparc/20170228-1.c: New test. + 2017-02-24 Eric Botcazou * 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 index 000000000000..575fbce528df --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/20170228-1.c @@ -0,0 +1,20 @@ +/* PR target/79749 */ +/* Reported by Rainer Orth */ + +/* { 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; +}