https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120837
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Self-contained testcase: [[gnu::noipa]] void bar (void **x, void **y) { x[0] = 0; x[1] = 0; x[2] = 0; y[0] = 0; y[1] = 0; y[2] = 0; y[3] = 0; y[4] = 0; } [[gnu::noipa]] void * foo (int x, int y) { void *a[3]; void *b[5]; bar (a, b); return (x > y ? b : a)[y - 1]; } int main () { if (foo (2, 1) != 0) __builtin_abort (); } Something during the C GENERIC folding creates invalid code out of it (but C++ doesn't): *((nNew > nOld ? (void * *) &apNew + 18446744073709551608 : (void * *) &apOld + 18446744073709551608) + (sizetype) ((long unsigned int) nOld * 8)) and later comes ubsan and is really unhappy about the negative offsets to arrays.