2016-09-28 Martin Sebor <msebor@redhat.com>
+ PR c/77762
+ * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c (test_vsnprintf_chk_s):
+ Call __builtin___vsnprintf_chk, not __builtin___snprintf_chk.
+ (test_sprintf_p_const): Adjust line numbers to avoid failures
+ introduced in r240503.
+
+2016-09-28 Martin Sebor <msebor@redhat.com>
+
PR middle-end/77683
* gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases.
format null pointers as 0 or 0x0 and so the following will only be
diagnosed on the former targets. */
T (5, "%p", (void*)0);
- /* { dg-warning "nul past the end" "(nil)" { target *-linux-gnu *-*-uclinux } 96 } */
+ /* { dg-warning "nul past the end" "(nil)" { target *-linux-gnu *-*-uclinux } .-1 } */
/* The exact output for %p is unspecified by C. Two formats are known:
same as %tx (for example AIX) and same as %#tx (for example Solaris). */
as with signed integer conversions (i.e., it prepends a space). Other
known implementations ignore it. */
T (6, "% p", (void*)0x234); /* { dg-warning ". . flag used with .%p." } */
- /* { dg-warning "nul past the end" "Glibc %p" { target *-linux-gnu } 108 } */
- /* { dg-warning "nul past the end" "Generic %p" { target *-*-uclinux } 108 } */
+ /* { dg-warning "nul past the end" "Glibc %p" { target *-linux-gnu } .-1 } */
+ /* { dg-warning "nul past the end" "Generic %p" { target *-*-uclinux } .-2 } */
}
/* Verify that no warning is issued for calls that write into a flexible
/* Verify that specifying a size of the destination buffer that's
bigger than its actual size (normally determined and passed to
the function by __builtin_object_size) is diagnosed. */
- __builtin___snprintf_chk (buffer, 123, 0, 122, " "); /* { dg-warning "always overflow|specified size 123 exceeds the size 122 of the destination object" } */
+ __builtin___vsnprintf_chk (buffer, 123, 0, 122, "%-s", va); /* { dg-warning "always overflow|specified size 123 exceeds the size 122 of the destination object" } */
- __builtin___snprintf_chk (buffer, __SIZE_MAX__, 0, 2, " "); /* { dg-warning "always overflow|destination size .\[0-9\]+. too large" } */
+ __builtin___vsnprintf_chk (buffer, __SIZE_MAX__, 0, 2, "%-s", va); /* { dg-warning "always overflow|destination size .\[0-9\]+. too large" } */
T (0, "%s");
T (1, "%s");