[Bug middle-end/98109] Seemingly wrong warnings from -Wnonnull when combined with -O2 -fsanitize=undefined
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 1 22:01:50 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98109
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Bernd Buschinski from comment #4)
> Can someone tell me if this should be a new bug or is just a duplicate?
It's the same bug. The sanitizer transforms the source code into the following
IR (note the 0B argument to my_memmem):
<bb 8> [local count: 390331996]:
if (str_path$buffer_7 == 0B)
goto <bb 9>; [0.00%]
else
goto <bb 14>; [100.00%]
<bb 9> [count: 0]:
__builtin___ubsan_handle_nonnull_arg (&*.Lubsan_data2);
_12 = my_memmem (0B, str_path$length_11, ".abcd", 5); <<< warning here
if (_12 != 0B)
goto <bb 18>; [54.59%]
else
goto <bb 19>; [45.41%]
More information about the Gcc-bugs
mailing list