I built latest gcc from git and then attempted to build things with it.
I noticed this new warning while trying to build diffutils, but
haven't had time to address:
Making all in lib
make[1]: Entering directory '/home/j/w/co/diffutils/lib'
make all-am
make[2]: Entering directory '/home/j/w/co/diffutils/lib'
CC vasnprintf.o
In file included from /usr/include/string.h:495,
from ./string.h:41,
from vasnprintf.c:79:
vasnprintf.c: In function 'vasnprintf':
/usr/include/bits/string_fortified.h:34:10: error: use of NULL 'result' where
non-null expected [CWE-476] [-Werror=analyzer-null-argument]
34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'vasnprintf': events 1-4
|
|vasnprintf.c:1858:6:
| 1858 | if (PRINTF_PARSE (format, &d, &a) < 0)
| | ^
| | |
| | (1) following 'false' branch...
|......
| 1868 | if (PRINTF_FETCHARGS (args, &a) < 0)
| | ~~ ~
| | | |
| | | (3) following 'false' branch...
| | (2) ...to here
|......
| 1876 | size_t buf_neededlength;
| | ~~~~~~
| | |
| | (4) ...to here
|
'vasnprintf': events 5-6
|
|xsize.h:66:30:
| 66 | return (sum >= size1 ? sum : SIZE_MAX);
| | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| | (5) following 'true' branch...
|......
| 80 | return xsum (xsum (xsum (size1, size2), size3), size4);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (6) ...to here
|
'vasnprintf': events 7-12
|
|vasnprintf.c:1892:8:
| 1892 | if (buf_neededlength < 4000 / sizeof (TCHAR_T))
| | ^
| | |
| | (7) following 'true' branch (when 'sum <= 3999')...
| 1893 | {
| 1894 | buf = (TCHAR_T *) alloca (buf_neededlength * sizeof
(TCHAR_T));
| | ~~~
| | |
| | (8) ...to here
|......
| 1909 | if (resultbuf != NULL)
| | ~
| | |
| | (9) following 'false' branch (when 'resultbuf' is NULL)...
|......
| 1919 | length = 0;
| | ~~~~~~
| | |
| | (10) ...to here
|......
| 1951 | if (cp != dp->dir_start)
| | ~
| | |
| | (11) following 'true' branch...
| 1952 | {
| 1953 | size_t n = dp->dir_start - cp;
| | ~~~~~~
| | |
| | (12) ...to here
|
'vasnprintf': event 13
|
|xsize.h:66:30:
| 66 | return (sum >= size1 ? sum : SIZE_MAX);
| | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
| | |
| | (13) following 'true' branch (when
'length <= sum')...
|
'vasnprintf': event 14
|
|vasnprintf.c:1954:39:
| 1954 | size_t augmented_length = xsum (length, n);
| | ^~~~~~~~~~~~~~~~
| | |
| | (14) ...to here
|
'vasnprintf': event 15
|
| 1927 | if ((needed) > allocated)
\
| | ^
| | |
| | (15) following 'false' branch...
vasnprintf.c:1956:13: note: in expansion of macro 'ENSURE_ALLOCATION'
| 1956 | ENSURE_ALLOCATION (augmented_length);
| | ^~~~~~~~~~~~~~~~~
|
'vasnprintf': event 16
|
| 151 | # define DCHAR_CPY memcpy
| | ^
| | |
| | (16) ...to here
vasnprintf.c:1945:11: note: in expansion of macro 'DCHAR_CPY'
| 1945 | DCHAR_CPY (memory, result, length);
\
| | ^~~~~~~~~
vasnprintf.c:1956:13: note: in expansion of macro 'ENSURE_ALLOCATION'
| 1956 | ENSURE_ALLOCATION (augmented_length);
| | ^~~~~~~~~~~~~~~~~
|
'vasnprintf': events 17-18
|
| 1962 | DCHAR_CPY (result + length, (const DCHAR_T *) cp,
n);
| | ~~~~~~~^~~~~~~~
| | |
| | (17) 'result' is NULL
| | (18) 'result' is NULL
|
'vasnprintf': event 19
|
|/usr/include/bits/string_fortified.h:34:10:
| 34 | return __builtin___memcpy_chk (__dest, __src, __len, __bos0
(__dest));
| |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (19) argument 1 ('<unknown>') NULL where non-null expected
|
<built-in>: note: argument 1 of '__builtin___memcpy_chk' must be non-null
cc1: all warnings being treated as errors
make[2]: *** [Makefile:2240: vasnprintf.o] Error 1
make[2]: Leaving directory '/home/j/w/co/diffutils/lib'
make[1]: *** [Makefile:1969: all] Error 2
make[1]: Leaving directory '/home/j/w/co/diffutils/lib'
make: *** [Makefile:1626: all-recursive] Error 1