https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103465
--- Comment #7 from Tomas Kalibera <tomas.kalibera at gmail dot com> ---
(In reply to Martin Liška from comment #5)
> > However, still talking about the current master only, I see a difference
> > with -O3, when I try on the repro example from Bug 103274 and -O3:
> >
> > x86_64-w64-mingw32-gcc -c -S -O3 -fno-reorder-blocks-and-partition a.c -o
> > nropt.s
> >
> > x86_64-w64-mingw32-gcc -c -S -O3 -freorder-blocks-and-partition a.c -o
> > ropt.s
> > x86_64-w64-mingw32-gcc -c -S -O3 a.c -o noopt.s
> >
> > All of these assembler files are different (and from my non-expert reading,
> > noopt.s uses the optimization and does have the invalid unwind information
> > as reported in Bug 103274). Is the optimization correctly dropped also with
> > -O3 only?
>
> Hmmm, I've just tested the same with the locally built cross-compiler:
> ~/Programming/gcc/configure --enable-languages=c,c++
> --prefix=/home/marxin/bin/gcc --disable-multilib --enable-host-shared
> --disable-libsanitizer --enable-valgrind-annotations --disable-bootstrap
> --target=x86_64-w64-mingw32
>
> and it works fine, all 3 assembly files are identical.
I am uploading a Dockerfile and my copy of the example which reproduces my
observation, but please note, it was for
5e5f880d0452ef2cffb94f4a686d56833c9f4215.
nropt.s has (correct unwind info, no reordering)
.L5:
call myerrorcall
nop
.seh_endproc
but ropt.s is same as noopt.s (incorrect unwind info, reordering)
.L5:
call myerrorcall
.seh_endproc
[...]
dummy.cold:
.L19:
So, from my reading the optimization was applied at -O3, it hence wasn't
dropped by target.