Closed yesudeep closed 2 years ago
Gonna need more details I think - the allocation happens just a few lines before that https://github.com/sheredom/utest.h/blob/master/utest.h#L1074
I believe GCC with the static analyzer (-fanalyzer
) turned on warns about this in case realloc
fails and the pointer is set to NULL
. One might want to add a NULL
check before dereferencing the pointer.
The configuration I was using when the warning was reported:
❯ CC=gcc12 ./configure --prefix=$HOME/code/foo/dist --enable-asan
... elided ...
Configuration parameters:
AR_FLAGS cru
CC gcc12
CFLAGS -g -O2 -std=c11 -fanalyzer -fdiagnostics-color=always -Wall -Wextra -Werror -Wfatal-errors -Wpedantic -pedantic-errors -Wformat=2 -Wformat-security -Wformat-y2k -Werror=missing-declarations -Werror=unused -Werror=unused-result -Werror=unused-local-typedefs -Werror=write-strings -Werror=sign-conversion -Werror=vla -Werror=narrowing -Werror=uninitialized -fsanitize=address
CPP gcc12 -E
CPPFLAGS
CXX g++
CXXFLAGS -g -O2
HOST
HOSTNAME
LDFLAGS
host amd64-unknown-freebsd13.0
install prefix /home/yesudeep/code/foo/dist
enable-asan yes
enable-tsan
enable-ubsan
References:
Error:
System information: