Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020201-1.c
blob1c770f55b2fd9fceb19f07b227c2c156d024f80a
1 /*
2 20020201-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 /* Test whether division by constant works properly. */
13 unsigned char cx = 7;
14 unsigned short sx = 14;
15 unsigned int ix = 21;
16 unsigned long lx = 28;
17 unsigned long long Lx = 35;
19 void
20 testTortureExecute (void)
22 #ifndef __SDCC_pdk14 // Lack of memory
23 unsigned char cy;
24 unsigned short sy;
25 unsigned int iy;
26 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
27 unsigned long ly;
28 unsigned long long Ly;
29 #endif
31 cy = cx / 6; ASSERT (cy == 1);
32 cy = cx % 6; ASSERT (cy == 1);
34 sy = sx / 6; ASSERT (sy == 2);
35 sy = sx % 6; ASSERT (sy == 2);
37 iy = ix / 6; ASSERT (iy == 3);
38 iy = ix % 6; ASSERT (iy == 3);
39 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
40 ly = lx / 6; ASSERT (ly == 4);
41 ly = lx % 6; ASSERT (ly == 4);
43 Ly = Lx / 6; ASSERT (Ly == 5);
44 Ly = Lx % 6; ASSERT (Ly == 5);
45 #endif
46 #endif