4 A temporary in an optimization for address calculations for array accesses used a signed 8-bit type to hold values up to 255, and then cast the result to a signed int.
9 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Not enough memory
10 unsigned char testArr255
[255]; // Fails
11 unsigned char testArr256
[256]; // Succeeds
23 for (j
= 7; j
< 10; j
++)
25 g(&testArr255
[i
* 24 + j
]);
26 g(&testArr256
[i
* 24 + j
]);
33 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Not enough memory
34 for(unsigned int i
= 0; i
< 250; i
++)
36 for(unsigned int i
= 0; i
< 250; i
++)
37 testArr256
[i
] = i
+ 1;
41 for(unsigned int i
= 0; i
< 127; i
++)
42 ASSERT(testArr255
[i
] == i
);
43 for(unsigned int i
= 0; i
< 127; i
++)
44 ASSERT(testArr256
[i
] == i
+ 1);
45 for(unsigned int i
= 127; i
< 130; i
++)
46 ASSERT(testArr255
[i
] == 0);
47 for(unsigned int i
= 127; i
< 130; i
++)
48 ASSERT(testArr256
[i
] == 0);
49 for(unsigned int i
= 130; i
< 250; i
++)
50 ASSERT(testArr255
[i
] == i
);
51 for(unsigned int i
= 130; i
< 250; i
++)
52 ASSERT(testArr256
[i
] == i
+ 1);