diff mbox series

[testsuite] Fix sibcall-9 and sibcall-10 with -fPIC

Message ID CAKnkMGuTBq0e+nSDwsjW1KEGkLQH_DgKpeU3BBuWMBaFuz8RqQ@mail.gmail.com
State New
Headers show
Series [testsuite] Fix sibcall-9 and sibcall-10 with -fPIC | expand

Commit Message

Thomas Preudhomme Oct. 23, 2018, 1:30 p.m. UTC
Hi,

gcc.dg/sibcall-9.c and gcc.dg/sibcall-10.c give execution failure
on ARM when compiled with -fPIC due to the PIC access to volatile
variable v creating an extra spill which causes the frame size of the
two recursive functions to be different. Making the variable static
solve the issue because the variable can be access in a PC-relative way
and avoid the spill, while still testing sibling call as originally
intended.

ChangeLog entry is as follows:

*** gcc/testsuite/ChangeLog ***

    * gcc.dg/sibcall-9.c: Make v static.
    * gcc.dg/sibcall-10.c: Likewise.

Tested both testcase with and without -fPIC and it now passes in both
case when targeting arm-none-eabi. It also passes in both cases on
x86_64-linux-gnu.

Is this ok for trunk?

Best regards,

Thomas

Comments

Jeff Law Oct. 24, 2018, 9:56 p.m. UTC | #1
On 10/23/18 7:30 AM, Thomas Preudhomme wrote:
> Hi,

> 

> gcc.dg/sibcall-9.c and gcc.dg/sibcall-10.c give execution failure

> on ARM when compiled with -fPIC due to the PIC access to volatile

> variable v creating an extra spill which causes the frame size of the

> two recursive functions to be different. Making the variable static

> solve the issue because the variable can be access in a PC-relative way

> and avoid the spill, while still testing sibling call as originally

> intended.

> 

> ChangeLog entry is as follows:

> 

> *** gcc/testsuite/ChangeLog ***

> 

>     * gcc.dg/sibcall-9.c: Make v static.

>     * gcc.dg/sibcall-10.c: Likewise.

> 

> Tested both testcase with and without -fPIC and it now passes in both

> case when targeting arm-none-eabi. It also passes in both cases on

> x86_64-linux-gnu.

> 

> Is this ok for trunk?

OK.

Jeff
diff mbox series

Patch

From 27286120fe2d6a088d14d7e4f4b5b6fa6cc2bc41 Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme@linaro.org>
Date: Tue, 23 Oct 2018 14:01:31 +0100
Subject: [PATCH] [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC

Hi,

gcc.dg/sibcall-9.c and gcc.dg/sibcall-10.c give execution failure
on ARM when compiled with -fPIC due to the PIC access to volatile
variable v creating an extra spill which causes the frame size of the
two recursive functions to be different. Making the variable static
solve the issue because the variable can be access in a PC-relative way
and avoid the spill, while still testing sibling call as originally
intended.

ChangeLog entry is as follows:

*** gcc/testsuite/ChangeLog ***

	* gcc.dg/sibcall-9.c: Make v static.
	* gcc.dg/sibcall-10.c: Likewise.

Tested both testcase with and without -fPIC and it now passes in both
case when targeting arm-none-eabi. It also passes in both cases on
x86_64-linux-gnu.

Is this ok for trunk?

Best regards,

Thomas
---
 gcc/testsuite/gcc.dg/sibcall-10.c | 2 +-
 gcc/testsuite/gcc.dg/sibcall-9.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/sibcall-10.c b/gcc/testsuite/gcc.dg/sibcall-10.c
index 54cc604aecf..4acca50e3e4 100644
--- a/gcc/testsuite/gcc.dg/sibcall-10.c
+++ b/gcc/testsuite/gcc.dg/sibcall-10.c
@@ -31,7 +31,7 @@  extern void exit (int);
 static ATTR void recurser_void1 (void);
 static ATTR void recurser_void2 (void);
 extern void track (void);
-volatile int v;
+static volatile int v;
 
 int n = 0;
 int main ()
diff --git a/gcc/testsuite/gcc.dg/sibcall-9.c b/gcc/testsuite/gcc.dg/sibcall-9.c
index fc3bd9dcf16..32b2e1d5d61 100644
--- a/gcc/testsuite/gcc.dg/sibcall-9.c
+++ b/gcc/testsuite/gcc.dg/sibcall-9.c
@@ -31,7 +31,7 @@  extern void exit (int);
 static ATTR void recurser_void1 (int);
 static ATTR void recurser_void2 (int);
 extern void track (int);
-volatile int v;
+static volatile int v;
 
 int main ()
 {
-- 
2.19.1