struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020503-1.c
blob4f23e1f033354f53c440429038204733a60fde25
1 /*
2 20020503-1.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 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pic14) // Lack of memory
12 /* PR 6534 */
13 /* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
14 insertted the code at the wrong place corrupting the i<0 test. */
16 static char *
17 inttostr (long i, char buf[128])
19 unsigned long ui = i;
20 char *p = buf + 127;
21 *p = '\0';
22 if (i < 0)
23 ui = -ui;
25 *--p = '0' + ui % 10;
26 while ((ui /= 10) != 0);
27 if (i < 0)
28 *--p = '-';
29 return p;
31 #endif
33 void
34 testTortureExecute (void)
36 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pic14) // Lack of memory
37 char buf[128], *p;
39 p = inttostr (-1, buf);
40 if (*p != '-')
41 ASSERT (0);
42 return;
43 #endif