]> gcc.gnu.org Git - gcc.git/commitdiff
PR lto/84212 - -Wno-* does not disable warnings from -flto link stage
authorMartin Sebor <msebor@redhat.com>
Fri, 9 Feb 2018 17:58:54 +0000 (17:58 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Fri, 9 Feb 2018 17:58:54 +0000 (10:58 -0700)
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.

From-SVN: r257534

gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr84212_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr84212_1.c [new file with mode: 0644]

index 881df2c3e22f7c06846f4570f08037272ce6d5bc..2378181deb43b82518d4199d5b00ae63d390c356 100644 (file)
@@ -1,3 +1,12 @@
+2018-02-09  Martin Sebor  <msebor@redhat.com>
+
+       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.
+
 2018-02-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * c-ada-spec.c (dump_ada_declaration): Do not generate the 'constant'
index 9c7172607a7e0ee8094f23dfafab68eb2e81eb21..7fb386d456de3a2ab497523a6e1321084fd7de9f 100644 (file)
@@ -304,7 +304,7 @@ C ObjC C++ ObjC++ Var(warn_alloca) Warning
 Warn on any use of alloca.
 
 Walloc-size-larger-than=
-C ObjC C++ ObjC++ Var(warn_alloc_size_limit) Warning Joined LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ LTO ObjC++ Var(warn_alloc_size_limit) Warning Joined LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
 -Walloc-size-larger-than=<bytes> Warn for calls to allocation functions that
 attempt to allocate objects larger than the specified number of bytes.
 
@@ -319,11 +319,11 @@ alloca, and on bounded uses of alloca whose bound can be larger than
 <number> bytes.
 
 Warray-bounds
-LangEnabledBy(C ObjC C++ ObjC++,Wall)
+LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
 ; in common.opt
 
 Warray-bounds=
-LangEnabledBy(C ObjC C++ ObjC++,Wall,1,0)
+LangEnabledBy(C ObjC C++ LTO ObjC++,Wall,1,0)
 ; in common.opt
 
 Wassign-intercept
@@ -575,12 +575,12 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEn
 Warn about printf/scanf/strftime/strfmon format string anomalies.
 
 Wformat-overflow=
-C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_overflow) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_overflow) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
 Warn about function calls with format strings that write past the end
 of the destination region.
 
 Wformat-truncation=
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format_trunc) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_format_trunc) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=, warn_format >= 1, 0) IntegerRange(0, 2)
 Warn about calls to snprintf and similar functions that truncate output.
 
 Wif-not-aligned
@@ -739,17 +739,17 @@ C ObjC C++ ObjC++ Var(warn_sizeof_array_argument) Warning Init(1)
 Warn when sizeof is applied on a parameter declared as an array.
 
 Wstringop-overflow
-C ObjC C++ ObjC++ Warning Alias(Wstringop-overflow=, 2, 0)
+C ObjC C++ LTO ObjC++ Warning Alias(Wstringop-overflow=, 2, 0)
 Warn about buffer overflow in string manipulation functions like memcpy
 and strcpy.
 
 Wstringop-overflow=
-C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_stringop_overflow) Init(2) Warning LangEnabledBy(C ObjC C++ ObjC++, Wall, 2, 0) IntegerRange(0, 4)
+C ObjC C++ LTO ObjC++ Joined RejectNegative UInteger Var(warn_stringop_overflow) Init(2) Warning LangEnabledBy(C ObjC C++ LTO ObjC++, Wall, 2, 0) IntegerRange(0, 4)
 Under the control of Object Size type, warn about buffer overflow in string
 manipulation functions like memcpy and strcpy.
 
 Wstringop-truncation
-C ObjC C++ ObjC++ Var(warn_stringop_truncation) Warning Init (1) LangEnabledBy(C ObjC C++ ObjC++, Wall)
+C ObjC C++ LTO ObjC++ Var(warn_stringop_truncation) Warning Init (1) LangEnabledBy(C ObjC C++ LTO ObjC++, Wall)
 Warn about truncation in string manipulation functions like strncat and strncpy.
 
 Wsuggest-attribute=format
@@ -833,11 +833,11 @@ C++ ObjC++ Var(warn_nonvdtor) Warning LangEnabledBy(C++ ObjC++,Weffc++)
 Warn about non-virtual destructors.
 
 Wnonnull
-C ObjC C++ ObjC++ Var(warn_nonnull) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=,warn_format >= 1,0)
+C ObjC C++ LTO ObjC++ Var(warn_nonnull) Warning LangEnabledBy(C ObjC C++ LTO ObjC++,Wformat=,warn_format >= 1,0)
 Warn about NULL being passed to argument slots marked as requiring non-NULL.
 
 Wnonnull
-C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ LTO ObjC++ LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
 ;
 
 Wnonnull-compare
@@ -1084,11 +1084,11 @@ C ObjC C++ ObjC++ CPP(warn_undef) CppReason(CPP_W_UNDEF) Var(cpp_warn_undef) Ini
 Warn if an undefined macro is used in an #if directive.
 
 Wuninitialized
-C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ LTO LangEnabledBy(C ObjC C++ ObjC++ LTO,Wall)
 ;
 
 Wmaybe-uninitialized
-C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall)
+C ObjC C++ ObjC++ LTO LangEnabledBy(C ObjC C++ ObjC++ LTO,Wall)
 ;
 
 Wunknown-pragmas
index f381e22a9b9933dbdc64fb1113924666b3177505..c30389548e4325d335713755f53ddab36fb3bcc4 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-09  Martin Sebor  <msebor@redhat.com>
+
+       PR lto/84212
+       * gcc.dg/lto/pr84212_0.c: New test file.
+       * gcc.dg/lto/pr84212_1.c: Same.
+
 2018-02-09  Peter Bergner  <bergner@vnet.ibm.com>
 
        PR target/83926
diff --git a/gcc/testsuite/gcc.dg/lto/pr84212_0.c b/gcc/testsuite/gcc.dg/lto/pr84212_0.c
new file mode 100644 (file)
index 0000000..859b2fa
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR lto/84212 - -Wno-stringop-verflow does not disable warnings from
+   -flto link stage
+   { dg-lto-do link }
+   { dg-lto-options { { -O2 -Werror -Wno-stringop-overflow -flto } } }  */
+
+#include <string.h>
+
+void clear (char *p, unsigned n)
+{
+  memset (p, 0, n);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/pr84212_1.c b/gcc/testsuite/gcc.dg/lto/pr84212_1.c
new file mode 100644 (file)
index 0000000..7ad8a7d
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR lto/84212 - -Wno-stringop-verflow does not disable warnings from
+   -flto link stage  */
+
+extern void clear (char*, unsigned);
+
+int main (void)
+{
+  char x[3];
+
+  clear (x, 4);
+}
This page took 0.091258 seconds and 5 git commands to generate.