libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / builtin-sprintf-warn-27.c
blob8188dd8005f98c0b5400f90c648d47c4d6b76bba
1 /* PR middle-end/100325 - missing warning with -O0 on sprintf overflow with
2 pointer plus offset
3 { dg-do compile }
4 { dg-options "-O0 -Wall" } */
6 #define S(n) (&"0123456789"[10 - n])
8 extern int sprintf (char*, const char*, ...);
10 char d[10];
12 void nowarn_d10_s9 ()
14 sprintf (d, "%s", S (9)); // { dg-bogus "-Wformat-overflow" }
17 void warn_d10_s10 ()
19 sprintf (d, "%s", S (10)); // { dg-warning "-Wformat-overflow" }