On Wed, Jun 28, 2023 at 8:04 AM Michael Matz <m...@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.