struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020402-1.c
blobfd3caa6ff5eca3343176ecfe92e93035b853d79d
1 /*
2 20020402-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 /* derived from PR c/2100 */
13 #define SMALL_N 2
14 #define NUM_ELEM 4
16 void testTortureExecute(void)
18 int listElem[NUM_ELEM]={30,2,10,5};
19 int listSmall[SMALL_N];
20 int i, j;
21 int posGreatest=-1, greatest=-1;
23 for (i=0; i<SMALL_N; i++) {
24 listSmall[i] = listElem[i];
25 if (listElem[i] > greatest) {
26 posGreatest = i;
27 greatest = listElem[i];
31 for (i=SMALL_N; i<NUM_ELEM; i++) {
32 if (listElem[i] < greatest) {
33 listSmall[posGreatest] = listElem[i];
34 posGreatest = 0;
35 greatest = listSmall[0];
36 for (j=1; j<SMALL_N; j++)
37 if (listSmall[j] > greatest) {
38 posGreatest = j;
39 greatest = listSmall[j];
44 if (listSmall[0] != 5 || listSmall[1] != 2)
45 ASSERT (0);
46 return;