https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91555
--- Comment #6 from Daniel Richard G. <skunk at iskunk dot org> --- Unfortunately, this GCC build does not have libsanitizer, as it is on an older (Linux) system without the necessary system headers. $ gcc -O2 -fsanitize=undefined gcc9-opt-bug.c -o bug /usr/bin/ld: cannot find -lubsan collect2: error: ld returned 1 exit status (I get a similar error on the Solaris system.) Are you able to reproduce the -O1/-O2 split in behavior?