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-loop-13.c
blobd43f011d7b11204a5cab07b3288a5b174318eec6
1 /*
2 loop-13.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR opt/7130 */
12 #define TYPE long
14 #if !defined(__SDCC_pdk14) // Lack of memory
15 void
16 scale (TYPE *alpha, TYPE *x, int n)
18 int i, ix;
20 if (*alpha != 1)
21 for (i = 0, ix = 0; i < n; i++, ix += 2)
23 TYPE tmpr, tmpi;
24 tmpr = *alpha * x[ix];
25 tmpi = *alpha * x[ix + 1];
26 x[ix] = tmpr;
27 x[ix + 1] = tmpi;
30 #endif
32 void
33 testTortureExecute (void)
35 #if !defined(__SDCC_pdk14) // Lack of memory
36 int i;
37 TYPE x[10];
38 TYPE alpha = 2;
40 for (i = 0; i < 10; i++)
41 x[i] = i;
43 scale (&alpha, x, 5);
45 if (x[9] != 18)
46 ASSERT (0);
48 return;
49 #endif