public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Preudhomme <thomas.preudhomme@linaro.org>
To: Rainer Orth <ro@cebitec.uni-bielefeld.de>,
	Mike Stump <mikestump@comcast.net>,
		Jakub Jelinek <jakub@redhat.com>,
	gcc-patches@gcc.gnu.org
Subject: [PATCH, testsuite] Fix sibcall-9 and sibcall-10 with -fPIC
Date: Tue, 23 Oct 2018 13:58:00 -0000	[thread overview]
Message-ID: <CAKnkMGuTBq0e+nSDwsjW1KEGkLQH_DgKpeU3BBuWMBaFuz8RqQ@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2018-10-23 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 13:58 Thomas Preudhomme [this message]
2018-10-24 22:31 ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKnkMGuTBq0e+nSDwsjW1KEGkLQH_DgKpeU3BBuWMBaFuz8RqQ@mail.gmail.com \
    --to=thomas.preudhomme@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).