On Sat, Sep 17, 2022 at 11:18:56PM +0800, Haoxin Tu via Gcc wrote: > Dear developers, > > May I seek your help with some understanding of why GCC produces the > wrong-code bug? I understand that such a bug can only be reproduced in an > old GCC version, but I still want to know why GCC made mistake here. > > The bug-revealing code makes GCC-4.7.0 produce miscompiled code under the > -O3 option. > > $gcc-4.7.0 -O1 s.c -o s1; ./s1 > Aborted (core dumped) > $gcc-4.7.0 -O3 s.c -o s2; ./s2
>From what I can see, this has been introduced in r0-109841-g42373e0b05c26d047925387d71fa833540dad8f0 aka PR49094 fix and got fixed in r0-118982-gf2ea3c151c65c472024cf22b2e772819578d2011 aka PR54634 fix. But if you want to know more, you need to figure it out yourself, nobody is going to spend time on no longer supported 10 years old compiler. Jakub