struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-981001-1.c
blob52eb9d7b56fe790667664098baaa122ef8aee835
1 /*
2 981001-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 #define NG 0x100L
13 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
14 unsigned long flg = 0;
16 long sub (int n) __reentrant
18 int a, b ;
20 if (n >= 2)
22 if (n % 2 == 0)
24 a = sub (n / 2);
26 return (a + 2 * sub (n / 2 - 1)) * a;
28 else
30 a = sub (n / 2 + 1);
31 b = sub (n / 2);
33 return a * a + b * b;
36 else
37 return (long) n;
39 #endif
41 void
42 testTortureExecute (void)
44 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
45 if (sub (30) != 832040L)
46 flg |= NG;
48 if (flg)
49 ASSERT (0);
51 return;
52 #endif