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.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(-)
@@ -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 ()
@@ -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