public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC
@ 2018-10-23 13:58 Thomas Preudhomme
  2018-10-24 22:31 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Preudhomme @ 2018-10-23 13:58 UTC (permalink / raw)
  To: Rainer Orth, Mike Stump, Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

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

[-- Attachment #2: fix_sibcall_9-10_fPIC.patch --]
[-- Type: text/x-patch, Size: 1982 bytes --]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC
  2018-10-23 13:58 [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC Thomas Preudhomme
@ 2018-10-24 22:31 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-10-24 22:31 UTC (permalink / raw)
  To: Thomas Preudhomme, Rainer Orth, Mike Stump, Jakub Jelinek, gcc-patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-24 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23 13:58 [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC Thomas Preudhomme
2018-10-24 22:31 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).