[C++ PATCH] Toplevel asm volatile (PR c++/89585)

Jakub Jelinek jakub@redhat.com
Thu Mar 7 21:34:00 GMT 2019


On Thu, Mar 07, 2019 at 10:11:56PM +0100, Matthias Klose wrote:
> On 07.03.19 00:39, Jakub Jelinek wrote:
> > The following patch tries to improve diagnostics of toplevel asm qualifiers
> > in C++ by actually parsing them and complaining if they appear at toplevel,
> > instead of just emitting a parse error that ( is expected, e.g. some
> > versions of Qt do use toplevel asm volatile and apparently the Qt code is
> > copied into lots of various projects.
> > 
> > In addition to that, it mentions in the documentation that qualifiers are
> > not allowed at toplevel asm statements; apparently our documentation at
> > least from r220506 for GCC 5 says that at toplevel Basic Asm needs to be
> > used and for Basic Asm lists volatile qualifier as optional and its behavior
> > (that it is ignored for Basic Asm).  Makes me wonder if we don't want to
> > keep accepting/ignoring volatile at toplevel for both C and C++ instead of
> > rejecting it (and rejecting just the other qualifiers).  Thoughts on this?
> > 
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> > 
> > Attached is an untested backport of this patch to 8.4, which does allow
> > asm volatile at toplevel, so that we don't break in 8.4 what has been
> > accepted in 8.2.  Ok if it passes bootstrap/regtest there?
> 
> isn't that required for the gcc-7 branch as well?

Yes.

> r267536 backported these patches to the 7 branch as well.

If you've tested it, feel free to commit it to 7.x.

	Jakub



More information about the Gcc-patches mailing list