From: Christophe Lyon <christophe.lyon@linaro.org>
To: Jeff Law <law@redhat.com>
Cc: Bernd Edlinger <bernd.edlinger@hotmail.de>,
Jakub Jelinek <jakub@redhat.com>,
Dimitar Dimitrov <dimitar@dinux.eu>,
Segher Boessenkool <segher@kernel.crashing.org>,
Thomas Preudhomme <thomas.preudhomme@linaro.org>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807
Date: Thu, 17 Jan 2019 14:27:00 -0000 [thread overview]
Message-ID: <CAKdteOY6QaJgxFm4WoUQBDnNarTW8=cWoZeyA5_rBa_VORD3Fw@mail.gmail.com> (raw)
In-Reply-To: <088aeff6-8a4c-7bad-0417-b6b3568ab3ae@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4372 bytes --]
On Fri, 11 Jan 2019 at 23:59, Jeff Law <law@redhat.com> wrote:
>
> On 1/8/19 5:03 AM, Richard Sandiford wrote:
> > Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> >> On 1/7/19 10:23 AM, Jakub Jelinek wrote:
> >>> On Sun, Dec 16, 2018 at 06:13:57PM +0200, Dimitar Dimitrov wrote:
> >>>> - /* 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");
> >>>
> >>> Why do we write Stack Pointer rather than stack pointer? That is really
> >>> weird. The second warning would be a note based on the first one, i.e.
> >>> if (warning ()) note ();
> >>> and better have some -W* option to silence the warning.
> >>>
> >>
> >> Yes, thanks for this suggestion.
> >>
> >> Meanwhile I found out, that the stack clobber has only been ignored up to
> >> gcc-5 (at least with lra targets, not really sure about reload targets).
> >> From gcc-6 on, with the exception of PR arm/77904 which was a regression due
> >> to the underlying lra change, but fixed later, and back-ported to gcc-6.3.0,
> >> this works for all targets I tried so far.
> >>
> >> To me, it starts to look like a rather unique and useful feature, that I would
> >> like to keep working.
> >
> > Not sure what you mean by "unique". But forcing a frame is a bit of
> > a slippery concept. Force it where? For the asm only, or the whole
> > function? This depends on optimisation and hasn't been consistent
> > across GCC versions, since it depends on the shrink-wrapping
> > optimisation. (There was a similar controversy a while ago about
> > to what extent -fno-omit-frame-pointer should "force a frame".)
> >
> > The effect on the redzone seems like something that should be specified
> > explicitly rather than as an (accidental?) side effect of listing the
> > sp in the clobber list. Maybe this would be another use for the "asm
> > attributes" proposal. "noreturn" was another attribute suggested on
> > IRC yesterday.
> >
> > But either way, the general feeling seems to be that going straight to a
> > hard error is too harsh, since there's quite a bit of existing code that
> > has the clobber. This patch implements the compromise discussed on IRC
> > yesterday of making it a -Wdeprecated warning instead.
> >
> > Tested on x86_64-linux-gnu and aarch64-linux-gnu. OK to install?
> >
> > Richard
> >
> > Dimitar: sorry the run-around on this patch, and thanks for the
> > submission. It looks from all the controversy like it was a
> > long-festering PR for a reason. :-/
> >
> >
> > 2019-01-07 Richard Sandiford <richard.sandiford@arm.com>
> >
> > gcc/
> > PR inline-asm/52813
> > * doc/extend.texi: Document that listing the stack pointer in the
> > clobber list of an asm is a deprecated feature.
> > * common.opt (Wdeprecated): Moved from c-family/c.opt.
> > * cfgexpand.c (asm_clobber_reg_is_valid): Issue a -Wdeprecated
> > warning instead of an error for clobbers of the stack pointer.
> > Add a note explaining why.
> >
> > gcc/c-family/
> > PR inline-asm/52813
> > * c.opt (Wdeprecated): Move documentation and variable to common.opt.
> >
> > gcc/d/
> > PR inline-asm/52813
> > * lang.opt (Wdeprecated): Reference common.opt instead of c.opt.
> >
> > gcc/testsuite/
> > PR inline-asm/52813
> > * gcc.target/i386/pr52813.c (test1): Turn the diagnostic into a
> > -Wdeprecated warning and expect a following note:.
> OK.
>
> FWIW the number of packages affected in Fedora was in single digits,
> some of which have already been fixed.
>
> But if folks want to go with a deprecated warning instead of straight to
> an error, I won't complain.
>
> jeff
Hi,
I originally complained because the arm test for pr77904.c was failing.
Since Richard's change that test emits a warning rather than an error,
but still fails. This small patch adds the missing dg-warning.
OK?
Thanks,
Christophe
[-- Attachment #2: pr77904.chlog.txt --]
[-- Type: text/plain, Size: 120 bytes --]
2019-01-17 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/arm/pr77904.c: Add dg-warning for sp clobber.
[-- Attachment #3: pr77904.patch.txt --]
[-- Type: text/plain, Size: 470 bytes --]
diff --git a/gcc/testsuite/gcc.target/arm/pr77904.c b/gcc/testsuite/gcc.target/arm/pr77904.c
index 76728c0..f279ec8 100644
--- a/gcc/testsuite/gcc.target/arm/pr77904.c
+++ b/gcc/testsuite/gcc.target/arm/pr77904.c
@@ -4,7 +4,8 @@
__attribute__ ((noinline, noclone)) void
clobber_sp (void)
{
- __asm volatile ("" : : : "sp");
+ __asm volatile ("" : : : "sp"); /* { dg-warning "listing the stack pointer register 'sp' in a clobber list is deprecated" } */
+
}
int
next prev parent reply other threads:[~2019-01-17 14:27 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
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 [this message]
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='CAKdteOY6QaJgxFm4WoUQBDnNarTW8=cWoZeyA5_rBa_VORD3Fw@mail.gmail.com' \
--to=christophe.lyon@linaro.org \
--cc=bernd.edlinger@hotmail.de \
--cc=dimitar@dinux.eu \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=law@redhat.com \
--cc=richard.sandiford@arm.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).