Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2558.c
blob46b3b036724e04386c0ab417898f014e96495f37
1 /* bug-2807.c
2 Sign of % operand lost in redundancy elimination.
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 uint16_t x;
11 static inline uint16_t llvm_srem_u16(int16_t a, int16_t b) {
12 uint16_t r = a % b;
13 return r;
16 static inline uint16_t returnx(void)
18 return x;
21 void foo(void)
23 x=llvm_srem_u16(x,returnx());
26 void testBug(void)
28 x = (unsigned)(-1);
29 foo();
30 ASSERT (x == (unsigned)(-23) % (unsigned)(-23));