https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107893
--- Comment #4 from Li Shaohua <shaohua.li at inf dot ethz.ch> --- (In reply to Richard Biener from comment #3) > That is, > > int main() { > int *a = 0; > (a[0] | a[1]) >> 056; > } > > works at -O0: > > t.c:3:6: runtime error: load of null pointer of type 'int' Yes, the a[1] access caused the segfault. For clang's UBsan, it emits an error message for a[1]: a.c:3:5: runtime error: applying non-zero offset 4 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior a.c:3:5 in Is there a way for gcc's UBsan to warn such errors?