blob: 9a2ebc4c46c42ac72a3d72fcc051c73b0916a101 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
bug-2403.c
*/
#include <testfwk.h>
#define CONST 0x09090909UL
typedef struct
{
unsigned char a;
unsigned char b;
unsigned int c;
unsigned long d;
unsigned long e;
unsigned long f;
} struct_one;
#ifndef __SDCC_pdk14 // Not enough RAM
__xdata struct_one test;
unsigned long sum;
unsigned long badd (__xdata struct_one *pointer)
{
sum = pointer->e + pointer->f;
if (sum)
return CONST / sum;
else
return 0;
}
unsigned long add (__xdata struct_one *pointer)
{
sum = pointer->e + pointer->f;
return CONST / sum;
}
#endif
void testBug (void)
{
#ifndef __SDCC_pdk14 // Not enough RAM
test.e = 0x01010101;
test.f = 0x02020202;
ASSERT (3UL == add(&test));
#endif
}
|