[Bug lto/71907] [6/7 regression] missing buffer overflow warnings with -flto

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jul 16 23:50:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71907

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |5.1.0
            Summary|missing buffer overflow     |[6/7 regression] missing
                   |warnings with -flto         |buffer overflow warnings
                   |                            |with -flto
      Known to fail|                            |6.1.0, 7.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The warning is issued by GCC 5 but it disappeared in GCC 6.

$ (CC='/build/gcc-5.1.0/gcc/xgcc -B /build/gcc-5.1.0/gcc';
CFLAGS='-D_FORTIFY_SOURCE=2 -O2 -Wall -Wextra -Wpedantic'; set -x; for lto in
'' -flto; do $CC $CFLAGS -c $lto xyz.c && $CC $CFLAGS $lto xyz.o; done)
+ for lto in ''\'''\''' -flto
+ /build/gcc-5.1.0/gcc/xgcc -B /build/gcc-5.1.0/gcc -D_FORTIFY_SOURCE=2 -O2
-Wall -Wextra -Wpedantic -c xyz.c
In file included from /usr/include/string.h:639:0,
                 from xyz.c:1:
In function ‘strcpy’,
    inlined from ‘main’ at xyz.c:5:3:
/usr/include/bits/string3.h:104:10: warning: call to __builtin___memcpy_chk
will always overflow destination buffer
   return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
          ^
+ /build/gcc-5.1.0/gcc/xgcc -B /build/gcc-5.1.0/gcc -D_FORTIFY_SOURCE=2 -O2
-Wall -Wextra -Wpedantic xyz.o
+ for lto in ''\'''\''' -flto
+ /build/gcc-5.1.0/gcc/xgcc -B /build/gcc-5.1.0/gcc -D_FORTIFY_SOURCE=2 -O2
-Wall -Wextra -Wpedantic -c -flto xyz.c
+ /build/gcc-5.1.0/gcc/xgcc -B /build/gcc-5.1.0/gcc -D_FORTIFY_SOURCE=2 -O2
-Wall -Wextra -Wpedantic -flto xyz.o
In function ‘strcpy’,
    inlined from ‘main’ at xyz.c:5:3:
/usr/include/bits/string3.h:104:10: warning: call to __builtin___memcpy_chk
will always overflow destination buffer
   return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
          ^


More information about the Gcc-bugs mailing list