From: Dimitar Dimitrov <dimitar@dinux.eu>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
Christophe Lyon <christophe.lyon@linaro.org>,
Thomas Preudhomme <thomas.preudhomme@linaro.org>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Sandiford <rdsandiford@googlemail.com>
Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807
Date: Sun, 16 Dec 2018 16:14:00 -0000 [thread overview]
Message-ID: <85840089.MtehzfUrTt@tpdeb> (raw)
In-Reply-To: <DB7PR07MB53537B024F807B2F383C87B0E4A30@DB7PR07MB5353.eurprd07.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
On Sun, Dec 16 2018 at 14:36:26 EET Bernd Edlinger wrote:
> Hi,
>
> if I understood that right, then clobbering sp is and has always been
> ignored.
>
> If that is right, then I would much prefer a warning, that says exactly
> that, because that would also help to understand why removing that clobber
> statement is safe even for old gcc versions.
>
> Since your patch did not actually change the handling of the PIC register,
> that one should of course stay an error.
Thank you. Looks like general consensus is to have a warning. See attached
patch that switches the error to a warning.
Regards,
Dimitar
[-- Attachment #2: 0001-PR-target-52813.patch --]
[-- Type: text/x-patch, Size: 2298 bytes --]
From d589ebd7824b4505ab75a2404f49a7c200679545 Mon Sep 17 00:00:00 2001
From: Dimitar Dimitrov <dimitar@dinux.eu>
Date: Sun, 16 Dec 2018 10:13:18 +0200
Subject: [PATCH] PR target/52813
Turns out there are existing programs that clobber stack pointer.
To avoid disruption, switch the newly introduced error to a warning.
Tested with:
$ make check-gcc-c RUNTESTFLAGS="i386.exp=pr52813.c "
gcc/ChangeLog:
2018-12-16 Dimitar Dimitrov <dimitar@dinux.eu>
* cfgexpand.c (asm_clobber_reg_is_valid): Switch error to warning.
Add clarification why there is a warning.
gcc/testsuite/ChangeLog:
2018-12-16 Dimitar Dimitrov <dimitar@dinux.eu>
* gcc.target/i386/pr52813.c (test1): Update warning message.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
---
gcc/cfgexpand.c | 7 +++++--
gcc/testsuite/gcc.target/i386/pr52813.c | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 0d04bbcafce..1e44c9a7ad0 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2872,10 +2872,13 @@ asm_clobber_reg_is_valid (int regno, int nregs, const char *regname)
error ("PIC register clobbered by %qs in %<asm%>", regname);
is_valid = false;
}
- /* Clobbering the STACK POINTER register is an error. */
+ /* Clobbered STACK POINTER register is not saved/restored by GCC,
+ which is often unexpected by users. See PR52813. */
if (overlaps_hard_reg_set_p (regset, Pmode, STACK_POINTER_REGNUM))
{
- error ("Stack Pointer register clobbered by %qs in %<asm%>", regname);
+ warning (0, "Stack Pointer register clobbered by %qs in %<asm%>",
+ regname);
+ warning (0, "GCC has always ignored Stack Pointer %<asm%> clobbers");
is_valid = false;
}
diff --git a/gcc/testsuite/gcc.target/i386/pr52813.c b/gcc/testsuite/gcc.target/i386/pr52813.c
index 154ebbfc423..644fef15fef 100644
--- a/gcc/testsuite/gcc.target/i386/pr52813.c
+++ b/gcc/testsuite/gcc.target/i386/pr52813.c
@@ -5,5 +5,5 @@
void
test1 (void)
{
- asm volatile ("" : : : "%esp"); /* { dg-error "Stack Pointer register clobbered" } */
+ asm volatile ("" : : : "%esp"); /* { dg-warning "Stack Pointer register clobbered.\+GCC has always ignored Stack Pointer 'asm' clobbers" } */
}
--
2.11.0
next prev parent reply other threads:[~2018-12-16 16:14 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-16 14:36 Bernd Edlinger
2018-12-16 16:14 ` Dimitar Dimitrov [this message]
2018-12-17 11:47 ` Richard Sandiford
2018-12-17 12:54 ` Christophe Lyon
2018-12-17 13:35 ` Richard Sandiford
2018-12-17 13:42 ` Christophe Lyon
2018-12-17 14:05 ` Bernd Edlinger
2018-12-17 14:10 ` Bernd Edlinger
2018-12-17 15:55 ` Segher Boessenkool
2018-12-17 18:46 ` Richard Sandiford
2018-12-17 20:15 ` Bernd Edlinger
2018-12-19 6:40 ` Dimitar Dimitrov
2018-12-19 9:29 ` Segher Boessenkool
2018-12-18 14:16 ` Bernd Edlinger
2018-12-18 15:14 ` Bernd Edlinger
2019-01-07 9:23 ` Jakub Jelinek
2019-01-07 21:51 ` Bernd Edlinger
2019-01-08 12:03 ` Richard Sandiford
2019-01-10 13:21 ` Segher Boessenkool
2019-01-10 21:23 ` Richard Sandiford
2019-01-10 21:26 ` Jakub Jelinek
2019-01-10 21:56 ` Richard Sandiford
2019-01-11 12:26 ` Segher Boessenkool
2019-01-10 22:32 ` Bernd Edlinger
2019-01-11 12:18 ` Segher Boessenkool
2019-01-11 12:23 ` Richard Sandiford
2019-01-11 22:59 ` Jeff Law
2019-01-17 14:27 ` Christophe Lyon
2019-01-18 9:49 ` Richard Sandiford
-- strict thread matches above, loose matches on Subject: below --
2018-12-09 10:09 Dimitar Dimitrov
2018-12-10 11:21 ` Richard Sandiford
2018-12-10 19:36 ` Dimitar Dimitrov
2018-12-11 15:52 ` Richard Sandiford
2018-12-12 9:42 ` Christophe Lyon
2018-12-12 10:03 ` Christophe Lyon
2018-12-12 16:39 ` Dimitar Dimitrov
2018-12-12 10:30 ` Thomas Preudhomme
2018-12-12 11:21 ` Thomas Preudhomme
2018-12-12 13:19 ` Christophe Lyon
2018-12-12 15:13 ` Christophe Lyon
2018-12-12 15:35 ` Thomas Preudhomme
2018-12-12 16:26 ` Dimitar Dimitrov
2018-12-13 14:49 ` Segher Boessenkool
2018-12-13 22:21 ` Dimitar Dimitrov
2018-12-14 8:52 ` Segher Boessenkool
2018-12-16 8:43 ` Dimitar Dimitrov
2018-12-17 15:23 ` Segher Boessenkool
2018-12-14 13:49 ` Richard Sandiford
2018-12-15 15:38 ` Segher Boessenkool
2018-12-12 11:24 ` Andreas Schwab
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=85840089.MtehzfUrTt@tpdeb \
--to=dimitar@dinux.eu \
--cc=bernd.edlinger@hotmail.de \
--cc=christophe.lyon@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdsandiford@googlemail.com \
--cc=segher@kernel.crashing.org \
--cc=thomas.preudhomme@linaro.org \
/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).