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