https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112350
--- Comment #2 from Mohamed <mohamed.selim at dxc dot com> --- https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112350&GoAheadAndLogIn=1 it's shown here that the warning is triggered by setting -O3 optimization level to 3. I don't know if such behavior is expected i.e. triggering warning is coupled with optimization level!!! So the above link to compiler explorer example shows only the diagnostic error from the sanitizer, if -O3 is added the warning is triggered.