[Bug tree-optimization/122986] -Wmaybe-uninitialized warnings occur with -O2, but not O1 or O3
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 3 18:05:40 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122986
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>The values are initialized, so this seems like an optimization bug.
No there is undefined behavior due to aliasing violations.
You store to light as a struct Image32 (which contains 4 uint8_t) but then do a
load via uint32_t. And from an aliasing point of view, uint32_t and Image32
can't alias.
More information about the Gcc-bugs
mailing list