aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/compile/pr89998-1.c
blob: 87be00ce3ce85b4e4c4c849da57622e5084797bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* PR tree-optimization/89998 */

unsigned int sprintf (char *str, const char *fmt, ...);
unsigned int snprintf (char *str, __SIZE_TYPE__ len, const char *fmt, ...);

int
f1 (char *s)
{
  return sprintf (s, "foo");
}

int
f2 (char *s)
{
  return sprintf (s, "%d", 123);
}

int
f3 (int *p, char *s)
{
  const char *t = "bar";
  return sprintf (s, "%s", t);
}

int
f4 (char *s)
{
  return snprintf (s, 8, "foo");
}

int
f5 (char *s)
{
  return snprintf (s, 8, "%d", 123);
}

int
f6 (int *p, char *s)
{
  const char *t = "bar";
  return snprintf (s, 8, "%s", t);
}