Sooo, if I build a #c program on #gcc once with -O0 and once with -O2, and it outputs something different. And gcc builds it without any warnings, even with -Wall -Werror -Wextra -pedantic
. And also UBSan not finding any undefined behaviors.... Assuming all that, have I found a bug in GCC? 😬
(The disassembly gdb spits out for the offending function looks kinda wrong to me, but my ASM skills are a bit rusty...)
=> More informations about this toot | More toots from laria@duclaria.com
I now reduced this to a single ~100 lines file that does no dynamic memory allocations. I'm pretty sure I'm not doing something that is undefined behavior. Still getting different results with -O0 / -O2. Even more weirdly, the bug(?) goes away when I remove an assert that only does a simple comparison. Also goes away when I remove certain struct members that are never written or read from.
I'm pretty sure this is indeed a compiler bug 😱
Currently building GCC from source to test against that.
=> More informations about this toot | More toots from laria@duclaria.com
Cool. I can't even do that, make check fails for MPFR 4.1.0, needed by GCC.
=> More informations about this toot | More toots from laria@duclaria.com
Bonus for compiling GCC from source: Pretty CPU graph 🌈
=> More informations about this toot | More toots from laria@duclaria.com
Still happening with GCC build from source. And actually -O1 is enough. Seems like I get to write a bug report tomorrow
=> More informations about this toot | More toots from laria@duclaria.com
Finally wrote the #gcc bug report for this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116098
Honestly a bit intimidating writing a bug report for such a high profile project. I really hope I haven't overlooked something super obvious 😬🤓
=> More informations about this toot | More toots from laria@duclaria.com
@laria 👍 I know the feeling. It gets less intimidating over time. But isn't it rewarding how the bug report comes to life right away - with information (though very technical) about the cause and possible fix?
=> More informations about this toot | More toots from mkretz@floss.social
@mkretz yes, it really is rewarding :). Actually really impressed how quickly this got a response!
=> More informations about this toot | More toots from laria@duclaria.com This content has been proxied by September (ba2dc).Proxy Information
text/gemini