+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.
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.
--- /dev/null
+/* 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=]" } */
+}