PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / builtin-sprintf-warn-5.c
blob2a6739ec2f330dbc8f6075145cec43310f04e01d
1 /* PR bootstrap/77676 - powerpc64 and powerpc64le stage2 bootstrap fail
2 Test case from comment 6 on the bug. */
3 /* { dg-do compile } */
4 /* { dg-options "-Wall -Werror" } */
6 struct A
8 const char *a;
9 int b;
10 const char *c;
13 void bar (char *);
15 void
16 foo (struct A *p)
18 char s[4096];
19 const char *u = p->a;
20 const char *t;
21 while ((t = __builtin_strstr (u, "gcc/")))
22 u = t + 4;
24 /* Verfiy the following doesn't emit a warning. */
25 __builtin_sprintf (s, "%s:%i (%s)", u, p->b, p->c);
26 bar (s);