struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20050502-2.c
blob3ca1169c497ca0ea1de3ec0b78a67fb194356e05
1 /*
2 20050502-2.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #include <string.h>
13 /* PR target/21297 */
15 void
16 foo (char *x)
18 int i;
19 for (i = 0; i < 2; i++);
20 x[i + i] = '\0';
23 void
24 bar (char *x)
26 int i;
27 for (i = 0; i < 2; i++);
28 x[i + i + i + i] = '\0';
31 void
32 testTortureExecute (void)
34 char x[] = "IJKLMNOPQR";
35 foo (x);
36 if (memcmp (x, "IJKL\0NOPQR", sizeof x) != 0)
37 ASSERT (0);
38 x[4] = 'M';
39 bar (x);
40 if (memcmp (x, "IJKLMNOP\0R", sizeof x) != 0)
41 ASSERT (0);
42 return;