]>
Commit | Line | Data |
---|---|---|
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 | ||
5 | char d[32]; | |
6 | ||
7 | void gb (_Bool b) | |
8 | { | |
9 | __builtin_snprintf (d, 32, "%s", b); // { dg-warning "\\\[-Wformat" } | |
10 | } | |
11 | ||
12 | void gi (int i) | |
13 | { | |
14 | __builtin_snprintf (d, 32, "%s", i); // { dg-warning "\\\[-Wformat" } | |
15 | } | |
16 | ||
17 | void gd (char *d, double x) | |
18 | { | |
19 | __builtin_snprintf (d, 32, "%s", x); // { dg-warning "\\\[-Wformat" } | |
20 | } | |
21 | ||
22 | ||
23 | struct X { int i; }; | |
24 | ||
25 | void 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" } } */ |