]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-11.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / builtin-snprintf-11.c
CommitLineData
9816f509
MS
1/* PR middle-end/100732 - ICE on sprintf %s with integer argument
2 { dg-do compile }
3 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
4
5char d[32];
6
7void gb (_Bool b)
8{
9 __builtin_snprintf (d, 32, "%s", b); // { dg-warning "\\\[-Wformat" }
10}
11
12void gi (int i)
13{
14 __builtin_snprintf (d, 32, "%s", i); // { dg-warning "\\\[-Wformat" }
15}
16
17void gd (char *d, double x)
18{
19 __builtin_snprintf (d, 32, "%s", x); // { dg-warning "\\\[-Wformat" }
20}
21
22
23struct X { int i; };
24
25void gx (char *d, struct X x)
26{
27 __builtin_snprintf (d, 32, "%s", x); // { dg-warning "\\\[-Wformat" }
28}
29
30/* Also verify that the invalid sprintf call isn't folded to strcpy.
31 { dg-final { scan-tree-dump-times "snprintf" 4 "optimized" } }
32 { dg-final { scan-tree-dump-not "strcpy" "optimized" } } */