This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [RFC] PR target/52813 and target/11807
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Dimitar Dimitrov <dimitar at dinux dot eu>
- Cc: Christophe Lyon <christophe dot lyon at linaro dot org>, Thomas Preudhomme <thomas dot preudhomme at linaro dot org>, gcc Patches <gcc-patches at gcc dot gnu dot org>, Richard Sandiford <richard dot sandiford at arm dot com>, "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- Date: Thu, 13 Dec 2018 08:48:38 -0600
- Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807
- References: <20181209100856.14051-1-dimitar@dinux.eu> <CAKnkMGvqbnVU-Gap5X55mbY8f8cG1ZiVMitczgYVyPvK6EEvRA@mail.gmail.com> <CAKdteOaqBa4Cf8kTOEEWMeJgRxMaq45sXGTrjdq=4G7SWBw8Fg@mail.gmail.com> <4591520.WeSID5Fo3g@tpdeb>
On Wed, Dec 12, 2018 at 06:26:10PM +0200, Dimitar Dimitrov wrote:
> I expect that if I mark a HW register as "clobber", compiler would save its
> contents before executing the asm statement, and after that it would restore
> its contents. This is the GCC behaviour for all but the SP and PIC registers.
> That is why I believe that PR52813 is a valid bug.
It won't do it for *any* fixed registers. But you do not want to error
or even warn for some fixed registers, for example the "flags" register
on x86 is *always* written to by asm.
But you never want to warn for non-fixed registers, and e.g.
PIC_OFFSET_TABLE_REGNUM isn't always a fixed register (when flag_pic is 0
for example).
> I'm not sure how GCC could recover if SP is clobbered. If SP is clobbered in
> such a way that GCC will not notice (e.g. thread switching), then why should
> GCC know about it in the first place?
Up until today, GCC has always just ignored it if you claimed to clobber
the stack pointer.
Segher