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-20010224-1.c
blob79d7e73f3daf05e3581184c5704dbd714f3f32d8
1 /*
2 20010224-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 85
10 #endif
12 #include <stdint.h>
14 #if !defined(__SDCC_pdk14) // Lack of memory
15 int16_t logadd (int16_t *a, int16_t *b);
16 void ba_compute_psd (int16_t start);
18 int16_t masktab[6] = { 1, 2, 3, 4, 5};
19 int16_t psd[6] = { 50, 40, 30, 20, 10};
20 int16_t bndpsd[6] = { 1, 2, 3, 4, 5};
22 void ba_compute_psd (int16_t start)
24 int i,j,k;
25 int16_t lastbin = 4;
27 j = start;
28 k = masktab[start];
30 bndpsd[k] = psd[j];
31 j++;
33 for (i = j; i < lastbin; i++) {
34 bndpsd[k] = logadd(&bndpsd[k], &psd[j]);
35 j++;
38 #endif
40 int16_t logadd (int16_t *a, int16_t *b)
42 return *a + *b;
45 void
46 testTortureExecute (void)
48 #if !defined(__SDCC_pdk14) // Lack of memory
49 int i;
51 ba_compute_psd (0);
53 if (bndpsd[1] != 140) ASSERT (0);
54 return;
55 #endif