https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118900
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The undefinedness in this case is recorded as PR 118721 not being able to detected by ubsan. But even then you can still run into issues like this where `&b[2] == &c` at different optimization levels because the order of variables layout in memory is NOT defined by the standard. So you might get different behavior at runtime even with different compilers. Note even clang can produce different results at -O0 with the -fno-common/-fcommon option as that changes the layout of the variables slightly.