Hi Mark, On Thu, Aug 28, 2025 at 4:22 AM Mark Wielaard <m...@klomp.org> wrote: > > > > ‘__builtin___sprintf_chk’ argument 5 overlaps destination object > > ‘current_path’ [-Werror=restrict] > > [...] > > elfclassify.c: In function ‘check_ar_members’: > > elfclassify.c:47:14: note: destination object referenced by > > ‘restrict’-qualified argument 1 was declared here > > 47 | static char *current_path; > > > > gcc thinks one of the arguments to sprintf (ar_path) is an alias of > > the destination string (current_path). It's a false positive since > > current_path is reassigned before the sprintf call but the code can be > > adjusted to avoid this error. > > That is odd. Which gcc version is this with and which configure > options? Locally (GCC 15.2.1) seems fine. It clearly is a false > positive indeed. I'll try to work around it by using some local > temporary.
I'm using GCC 15.2.1 20250808 (Red Hat 15.2.1-1). CFLAGS=" -Og -ggdb -fno-omit-frame-pointer -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" configure options: --enable-maintainer-mode --enable-stacktrace --enable-debuginfod --enable-debuginfod-ima-verification --enable-valgrind The error only occurs when -O[0,g,1] is given. If -O2 then the error disappears. Aaron