From 4183b672c39ca87f8f4d4f7ba220491d23d6d4ba Mon Sep 17 00:00:00 2001 From: msebor Date: Fri, 9 Feb 2018 17:58:54 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257534 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/ChangeLog | 9 +++++++++ gcc/c-family/c.opt | 24 ++++++++++++------------ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/lto/pr84212_0.c | 11 +++++++++++ gcc/testsuite/gcc.dg/lto/pr84212_1.c | 11 +++++++++++ 5 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr84212_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr84212_1.c diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 881df2c3e22..2378181deb4 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2018-02-09 Martin Sebor + + 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 * c-ada-spec.c (dump_ada_declaration): Do not generate the 'constant' diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 9c7172607a7..7fb386d456d 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -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= 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 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f381e22a9b9..c30389548e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-02-09 Martin Sebor + + PR lto/84212 + * gcc.dg/lto/pr84212_0.c: New test file. + * gcc.dg/lto/pr84212_1.c: Same. + 2018-02-09 Peter Bergner 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 index 00000000000..859b2fa30f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr84212_0.c @@ -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 + +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 index 00000000000..7ad8a7d64b9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr84212_1.c @@ -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); +} -- 2.11.4.GIT