summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
blob: a78d0880cf37dabf8dc8ca0b4153e825d08bdee2 (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
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fab" } */

extern int printf (const char *, ...);
volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9, via;

void test (void)
{
  vi0 = 0;
  printf ("hello");
  vi1 = 0;
  printf ("hello\n");
  vi2 = 0;
  printf ("a");
  vi3 = 0;
  printf ("");
  vi4 = 0;
  printf ("%s", "hello");
  vi5 = 0;
  printf ("%s", "hello\n");
  vi6 = 0;
  printf ("%s", "a");
  vi7 = 0;
  printf ("%s", "");
  vi8 = 0;
  printf ("%c", 'x');
  vi9 = 0;
  printf ("%s\n", "hello\n");
  via = 0;
}

/* { dg-final { scan-tree-dump "vi0.*printf.*\"hello\".*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */
/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*printf.*\"hello\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*puts.*\"hello\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*putchar.*vi7" "fab"} } */
/* { dg-final { scan-tree-dump "vi7 ={v} 0\[^\(\)\]*vi8 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi8.*putchar.*vi9" "fab"} } */
/* { dg-final { scan-tree-dump "vi9.*puts.*\"hello\\\\n\".*via" "fab"} } */
/* { dg-final { cleanup-tree-dump "fab" } } */