From: Andrew Pinski <pinskia@gmail.com>
To: Michael Matz <matz@suse.de>
Cc: Julian Waters <tanksherman27@gmail.com>, gcc@gcc.gnu.org
Subject: Re: [PATCH] Basic asm blocks should always be volatile
Date: Wed, 28 Jun 2023 11:46:03 -0700 [thread overview]
Message-ID: <CA+=Sn1=XzgV_V0=ARjau5PuEg6kgw0yaK9Zt_kbR3pNjeb9Asw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.20.2306281459150.13548@wotan.suse.de>
On Wed, Jun 28, 2023 at 8:04 AM Michael Matz <matz@suse.de> wrote:
>
> Hello,
>
> On Wed, 28 Jun 2023, Julian Waters via Gcc wrote:
>
> > On the contrary, code compiled with gcc with or without the applied patch
> > operates very differently, with only gcc with the applied patch producing a
> > fully correctly operating program as expected. Even if the above inline
> > assembly blocks never worked due to other optimizations however, the
> > failure mode of the program would be very different from how it fails now:
> > It should fail noisily with an access violation exception due to
> > the malformed assembly, but instead all the assembly which installs an
> > exception handler never makes it into the final program because with
> > anything higher than -O1 gcc deletes all of it (I have verified this with
> > objdump too),
>
> Can you please provide a _full_ compilable testcase (preprocessed). What
> Andrew says is (supposed to be) correct: ignoring the other
> problems you're going to see with your asms (even if you make them
> volatile) GCC should not remove any of the asm statements of them.
>
> If something changes when you add 'volatile' by hand then we have another
> problem lurking somewhere, and adding the parser patch might not fully
> solve it (even if it changes behaviour for you).
By the way I just testcase:
```
void f(void)
{
asm("#should be volatile");
}
```
The produced gimple (via -fdump-tree-gimple=/dev/stdout) is:
```
void f ()
{
__asm__ __volatile__("#should be volatile");
}
```
Which is 100% volatile. and I tested all the way back to GCC 4.8.0 and
it was volatile back then too.
So as both Michael and myself have mentioned, we need a full
(compilable) testcase, even if it is for mingw or cygwin, we can
handle those just fine too.
Thanks,
Andrew
>
>
> Ciao,
> Michael.
next prev parent reply other threads:[~2023-06-28 18:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 16:01 Julian Waters
2023-06-27 16:08 ` Andrew Pinski
2023-06-27 16:15 ` Julian Waters
2023-06-27 16:15 ` Julian Waters
2023-06-27 16:24 ` Andrew Pinski
2023-06-27 16:23 ` Andrew Pinski
2023-06-28 7:31 ` Julian Waters
2023-06-28 7:38 ` Andrew Pinski
2023-06-28 10:43 ` Julian Waters
2023-06-28 15:04 ` Michael Matz
2023-06-28 18:46 ` Andrew Pinski [this message]
2023-06-29 6:42 ` Julian Waters
2023-06-29 13:27 ` Michael Matz
2023-06-30 6:11 ` Julian Waters
2023-06-27 16:07 Julian Waters
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='CA+=Sn1=XzgV_V0=ARjau5PuEg6kgw0yaK9Zt_kbR3pNjeb9Asw@mail.gmail.com' \
--to=pinskia@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=matz@suse.de \
--cc=tanksherman27@gmail.com \
/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).