Commit 281ac396 by Martin Sebor Committed by Martin Sebor

PR other/81345 - -Wall resets -Wstringop-overflow to 1 from the default 2

gcc/c-family/ChangeLog:

	PR other/81345
	* c.opt (-Wstringop-overflow): Set defaults in LangEnabledBy.

gcc/testsuite/ChangeLog:

	PR other/81345
	* gcc.dg/pr81345.c: New test.

From-SVN: r250104
parent b0e90d2a
2017-07-10 Martin Sebor <msebor@redhat.com>
PR other/81345
* c.opt (-Wstringop-overflow): Set defaults in LangEnabledBy.
2017-07-06 David Malcolm <dmalcolm@redhat.com>
* c-common.c (selftest::c_family_tests): New.
......
......@@ -732,7 +732,7 @@ 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) IntegerRange(0, 4)
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)
Under the control of Object Size type, warn about buffer overflow in string
manipulation functions like memcpy and strcpy.
......
2017-07-10 Martin Sebor <msebor@redhat.com>
PR other/81345
* gcc.dg/pr81345.c: New test.
2017-07-10 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/mulsi3_highpart-1.c: Remove 'X' constraint.
......
/* PR other/81345 - -Wall resets -Wstringop-overflow to 1 from the default 2
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
char a[3];
void f (const char *s)
{
__builtin_strncpy (a, s, sizeof a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
}
struct S { char a[3]; int i; };
void g (struct S *d, const char *s)
{
__builtin_strncpy (d->a, s, sizeof d->a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
}
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