]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.c-torture/execute/fprintf-2.c
bba4a446ee95822540866462ee5cab8dfc10598b
1 /* Verify that calls to fprintf don't get eliminated even if their
2 result on success can be computed at compile time (they can fail).
3 The calls can still be transformed into those of other functions.
4 { dg-skip-if "requires io" { freestanding } } */
12 char *tmpfname
= tmpnam (0);
13 FILE *f
= fopen (tmpfname
, "w");
16 perror ("fopen for writing");
21 fprintf (f
, "%c", '2');
22 fprintf (f
, "%c%c", '3', '4');
23 fprintf (f
, "%s", "5");
24 fprintf (f
, "%s%s", "6", "7");
26 fprintf (f
, "%.1s\n", "9x");
29 f
= fopen (tmpfname
, "r");
32 perror ("fopen for reading");
38 if (1 != fscanf (f
, "%s", buf
))
49 if (strcmp (buf
, "123456789"))