https://sourceware.org/bugzilla/show_bug.cgi?id=29141
Mark Wielaard <mark at klomp dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org,
| |siddhesh at sourceware dot org
--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
This is interesting. I recently fixed a similar warning in gdb (also for
-Werror=stringop-overflow, but not _FORTIFY_SOURCE related):
https://sourceware.org/pipermail/gdb-patches/2022-May/188694.html
I have added Siddhesh to the CC who might have seen this earlier.
Background is that in elfutils we are trying to use _FORTIFY_SOURCE=3 when it
is available using this configure snippet:
# See if we can add -D_FORTIFY_SOURCE=2 or =3. Don't do it if it is already
# (differently) defined or if it generates warnings/errors because we
# don't use the right optimisation level (string.h will warn about that).
AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 or =3 to CFLAGS])
case "$CFLAGS" in
*-D_FORTIFY_SOURCE=*)
AC_MSG_RESULT([no, already there])
;;
*)
save_CFLAGS="$CFLAGS"
# Try 3 first.
CFLAGS="-D_FORTIFY_SOURCE=3 $save_CFLAGS -Werror"
fortified_cflags=""
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
int main() { return 0; }
]])], [ AC_MSG_RESULT([yes -D_FORTIFY_SOURCE=3])
fortified_cflags="-D_FORTIFY_SOURCE=3" ], [])
# If that didn't work, try 2.
if test -z "$fortified_cflags"; then
CFLAGS="-D_FORTIFY_SOURCE=2 $save_CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
int main() { return 0; }
]])], [ AC_MSG_RESULT([yes -D_FORTIFY_SOURCE=2])
fortified_cflags="-D_FORTIFY_SOURCE=2" ],
[ AC_MSG_RESULT([no, cannot be used])])
fi
CFLAGS="$fortified_cflags $save_CFLAGS"
CXXFLAGS="$fortified_cflags $CXXFLAGS"
;;
esac
But it seems to produce gcc warnings like the above, so either our configure
foo is bad or we simply have to always use _FORTIFY_SOURCE=2.
--
You are receiving this mail because:
You are on the CC list for the bug.