+2017-01-11 Martin Sebor <msebor@redhat.com>
+
+ PR c/78768
+ * c.opt (-Walloca-larger-than, -Wformat-length, -Wformat-truncation):
+ Also enable for LTO.
+
2017-01-10 Jason Merrill <jason@redhat.com>
Implement P0195R2, C++17 variadic using.
-Walloc-zero Warn for calls to allocation functions that specify zero bytes.
Walloca-larger-than=
-C ObjC C++ ObjC++ Var(warn_alloca_limit) Warning Joined RejectNegative UInteger
+C ObjC C++ LTO ObjC++ Var(warn_alloca_limit) Warning Joined RejectNegative UInteger
-Walloca-larger-than=<number> Warn on unbounded uses of
alloca, and on bounded uses of alloca whose bound can be larger than
<number> bytes.
Warn if passing too many arguments to a function for its format string.
Wformat-length
-C ObjC C++ ObjC++ Warning Alias(Wformat-length=, 1, 0)
+C ObjC C++ LTO ObjC++ Warning Alias(Wformat-length=, 1, 0)
Warn about function calls with format strings that write past the end
of the destination region. Same as -Wformat-length=1.
Warn about sign differences with format functions.
Wformat-truncation
-C ObjC C++ ObjC++ Warning Alias(Wformat-truncation=, 1, 0)
+C ObjC C++ LTO ObjC++ Warning Alias(Wformat-truncation=, 1, 0)
Warn about calls to snprintf and similar functions that truncate output.
Same as -Wformat-truncation=1.
--- /dev/null
+/* PR c/78768 - -Walloca-larger-than and -Wformat-length warnings disabled
+ by -flto
+ { dg-do run }
+ { dg-options "-O2 -Walloca-larger-than=10 -Wformat -Wformat-length -flto" } */
+
+int main (void)
+{
+ char *d = (char *)__builtin_alloca (12); /* { dg-warning "argument to .alloca. is too large" } */
+
+ __builtin_sprintf (d, "%32s", "x"); /* { dg-warning "directive writing 32 bytes into a region of size 12" "-Wformat-length" { xfail *-*-* } } */
+
+ return 0;
+}