[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-09 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Martin Sebor  ---
Patch committed in r257534.

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-09 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

--- Comment #7 from Martin Sebor  ---
Author: msebor
Date: Fri Feb  9 17:58:54 2018
New Revision: 257534

URL: https://gcc.gnu.org/viewcvs?rev=257534=gcc=rev
Log:
PR lto/84212 - -Wno-* does not disable warnings from -flto link stage

gcc/c-family/ChangeLog:

PR lto/84212
* c.opt (-Wstringop-overflow, -Warray-bounds): Add LTO.
(-Walloc-size-larger-than, -Wformat-truncation=): Same.
(-Wmaybe-uninitialized, -Wnonnull, -Wrestrict): Same.
(-Wstrict-overflow, -Wsuggest-attribute): Same.
(-Wuninitialized): Same.

gcc/testsuite/ChangeLog:

PR lto/84212
* gcc.dg/lto/pr84212_0.c: New test file.
* gcc.dg/lto/pr84212_1.c: Same.

Added:
trunk/gcc/testsuite/gcc.dg/lto/pr84212_0.c
trunk/gcc/testsuite/gcc.dg/lto/pr84212_1.c
Modified:
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/testsuite/ChangeLog

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #6 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00350.html

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-07 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

Martin Sebor  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org

--- Comment #5 from Martin Sebor  ---
You're right.  I fixed it for bug 78768 in r244326 (-Walloca-larger-than and
-Wformat-overflow et al.) but missed -Wstringop-overflow.  Let me take care of
this.

I wonder if LTO should be implied for all warnings to avoid these mistakes.

Alternatively, have a script check to make sure that middle-end warnings are
enabled for in the .opt file(s), run it for each build and fail if not.

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

--- Comment #4 from Richard Biener  ---
Wstringop-overflow
C ObjC C++ ObjC++ Warning Alias(Wstringop-overflow=, 2, 0)
Warn about buffer overflow in string manipulation functions like memcpy
and strcpy.


LTO is missing in the list of supported FEs.  All middle-end warning also
need that.

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-06 Thread jay.foad at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

--- Comment #3 from Jay Foad  ---
Here you go:

$ gcc -O3 -flto a.o b.o -Wno-stringop-overflow -v -###
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
7.2.0-8ubuntu3.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr
--with-gcc-major-version-only --program-suffix=-7
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --with-target-system-zlib --enable-objc-gc=auto
--enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3.1) 
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/7/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-O3' '-flto' '-Wstringop-overflow=0' '-v' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/7/collect2 -plugin
/usr/lib/gcc/x86_64-linux-gnu/7/liblto_plugin.so
"-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper"
"-plugin-opt=-fresolution=/tmp/ccWxHzCo.res" "-plugin-opt=-pass-through=-lgcc"
"-plugin-opt=-pass-through=-lgcc_s" "-plugin-opt=-pass-through=-lc"
"-plugin-opt=-pass-through=-lgcc" "-plugin-opt=-pass-through=-lgcc_s" -flto
"--sysroot=/" --build-id --eh-frame-hdr -m elf_x86_64 "--hash-style=gnu"
--as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crti.o
/usr/lib/gcc/x86_64-linux-gnu/7/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/7
-L/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu
-L/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib -L/lib/x86_64-linux-gnu
-L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-linux-gnu/7/../../.. a.o b.o -lgcc --as-needed -lgcc_s
--no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed
/usr/lib/gcc/x86_64-linux-gnu/7/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crtn.o
COLLECT_GCC_OPTIONS='-O3' '-flto' '-Wstringop-overflow=0' '-v' '-mtune=generic'
'-march=x86-64'

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-05 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #2 from Manuel López-Ibáñez  ---
This is strange. Is the driver passing the warning options to the LTO compiler?
Does the LTO compiler process warning options or just drops them?

Perhaps -v -### would clarify what is going on?

[Bug lto/84212] -Wno-* does not disable warnings from -flto link stage

2018-02-05 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84212

Martin Sebor  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-02-05
 CC||msebor at gcc dot gnu.org
   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=71907,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=78768,
   ||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=79062
 Ever confirmed|0   |1
  Known to fail||7.3.0, 8.0

--- Comment #1 from Martin Sebor  ---
Confirmed with both 7.x where -Wstringop-overflow was first introduced and with
8.0, so it's not a regression.  (A false positive would be, independent of this
bug, if a test case is provided that reproduces it.)

Prior to the introduction of -Wstringop-overflow GCC would print the same
warning (minus the sizes) but with no option to suppress it.

$ (gcc -D_FORTIFY_SOURCE=2 -O3 -flto'; $gcc -c a.c b.c && gcc a.o b.o)
In function ‘memset’,
inlined from ‘main’ at a.c:4:2:
/usr/include/bits/string3.h:90:10: warning: call to __builtin___memset_chk will
always overflow destination buffer
   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
  ^

See also pr71907, pr78768, and pr79062,  for other problems with the
interaction of -flto and some of these middle-end options.