struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr80153.c
blob981916666b7f152f530b377288f7040b4e4a9c9d
1 /*
2 pr80153.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 85
10 #endif
12 #include <string.h>
14 /* PR tree-optimization/80153 */
16 void check (int, int, int);
17 void check (int c, int c2, int val)
19 (void)c;
20 (void)c2;
21 ASSERT (val);
24 static const char *buf;
25 static int l, i;
27 void _fputs(const char *str);
28 void _fputs(const char *str)
30 buf = str;
31 i = 0;
32 l = strlen(buf);
35 char _fgetc();
36 char _fgetc()
38 char val = buf[i];
39 i++;
40 if (i > l)
41 return -1;
42 else
43 return val;
46 static const char *string = "oops!\n";
48 void
49 testTortureExecute (void)
51 int i;
52 int c;
54 _fputs(string);
56 for (i = 0; i < strlen(string); i++) {
57 c = _fgetc();
58 check(c, string[i], c == string[i]);
61 return;