Commit cea71f0a by Martin Sebor Committed by Martin Sebor

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.

From-SVN: r257534
parent cad5b079
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> 2018-02-09 Eric Botcazou <ebotcazou@adacore.com>
* c-ada-spec.c (dump_ada_declaration): Do not generate the 'constant' * c-ada-spec.c (dump_ada_declaration): Do not generate the 'constant'
......
...@@ -304,7 +304,7 @@ C ObjC C++ ObjC++ Var(warn_alloca) Warning ...@@ -304,7 +304,7 @@ C ObjC C++ ObjC++ Var(warn_alloca) Warning
Warn on any use of alloca. Warn on any use of alloca.
Walloc-size-larger-than= 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 -Walloc-size-larger-than=<bytes> Warn for calls to allocation functions that
attempt to allocate objects larger than the specified number of bytes. 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 ...@@ -319,11 +319,11 @@ alloca, and on bounded uses of alloca whose bound can be larger than
<number> bytes. <number> bytes.
Warray-bounds Warray-bounds
LangEnabledBy(C ObjC C++ ObjC++,Wall) LangEnabledBy(C ObjC C++ LTO ObjC++,Wall)
; in common.opt ; in common.opt
Warray-bounds= Warray-bounds=
LangEnabledBy(C ObjC C++ ObjC++,Wall,1,0) LangEnabledBy(C ObjC C++ LTO ObjC++,Wall,1,0)
; in common.opt ; in common.opt
Wassign-intercept Wassign-intercept
...@@ -575,12 +575,12 @@ C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEn ...@@ -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. Warn about printf/scanf/strftime/strfmon format string anomalies.
Wformat-overflow= 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 Warn about function calls with format strings that write past the end
of the destination region. of the destination region.
Wformat-truncation= 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. Warn about calls to snprintf and similar functions that truncate output.
Wif-not-aligned Wif-not-aligned
...@@ -739,17 +739,17 @@ C ObjC C++ ObjC++ Var(warn_sizeof_array_argument) Warning Init(1) ...@@ -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. Warn when sizeof is applied on a parameter declared as an array.
Wstringop-overflow 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 Warn about buffer overflow in string manipulation functions like memcpy
and strcpy. and strcpy.
Wstringop-overflow= 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 Under the control of Object Size type, warn about buffer overflow in string
manipulation functions like memcpy and strcpy. manipulation functions like memcpy and strcpy.
Wstringop-truncation 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. Warn about truncation in string manipulation functions like strncat and strncpy.
Wsuggest-attribute=format Wsuggest-attribute=format
...@@ -833,11 +833,11 @@ C++ ObjC++ Var(warn_nonvdtor) Warning LangEnabledBy(C++ ObjC++,Weffc++) ...@@ -833,11 +833,11 @@ C++ ObjC++ Var(warn_nonvdtor) Warning LangEnabledBy(C++ ObjC++,Weffc++)
Warn about non-virtual destructors. Warn about non-virtual destructors.
Wnonnull 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. Warn about NULL being passed to argument slots marked as requiring non-NULL.
Wnonnull 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 Wnonnull-compare
...@@ -1084,11 +1084,11 @@ C ObjC C++ ObjC++ CPP(warn_undef) CppReason(CPP_W_UNDEF) Var(cpp_warn_undef) Ini ...@@ -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. Warn if an undefined macro is used in an #if directive.
Wuninitialized 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 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 Wunknown-pragmas
......
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> 2018-02-09 Peter Bergner <bergner@vnet.ibm.com>
PR target/83926 PR target/83926
......
/* 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);
}
/* 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment