https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95496
Paul Eggert <eggert at cs dot ucla.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eggert at cs dot ucla.edu
--- Comment #10 from Paul Eggert <eggert at cs dot ucla.edu> ---
Created attachment 58838
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58838&action=edit
12-line file illustrating the false positive
I ran into a similar problem today when building bleeding-edge GNU Make with
gcc (GCC) 14.1.1 20240701 (Red Hat 14.1.1-7) on x86-64. Compile the attached
12-line file with:
gcc -O2 -fsanitize=undefined -Wall -S v.i
and the false positive is:
v.i: In function ‘file_timestamp_sprintf’:
v.i:7:3: warning: null destination pointer [-Wformat-overflow=]
7 | sprintf (p, ".%09d", ns);
| ^~~~~~~~~~~~~~~~~~~~~~~~
I guess the moral of the story is: don't combine -fsanitize=undefined with
-Wall, which is unfortunate.