Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-3085.c
blob05737462091f5bb9742d81c6990a211b280ee19f
1 /* bug-3085.c
2 Pdk code generation for wide < overwrote upper byte of operand in p.
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 uint16_t f(void)
11 uint16_t cc = 0;
12 for (uint16_t j = 0; j < 500; j++) { // Code generation for upper byte for < overwrote upper byte of j.
13 cc++;
16 cc = ~cc;
18 return cc;
21 void
22 testBug(void)
24 ASSERT (f() == (uint16_t)(~(uint16_t)500));