Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-3522.c
blobab43488bd271461dab395bd3c655e84328147905
1 /* bug-3522.c
2 A bug in insertion of support function calls for multiplicative operators for _BitInt where one operand was a literal.
3 */
5 #include <testfwk.h>
7 #include <stdint.h>
9 #if __SDCC_BITINT_MAXWIDTH >= 32 // TODO: When we can regression-test in --std-c23 mode, use the standard macro from limits.h instead!
10 typedef _BitInt(32) data_t;
11 #else
12 typedef int32_t data_t; // this one worked
13 #endif
15 data_t foo(int val) {
16 return (data_t)val/2; // Compiler internal error on this line for _BitInt.
19 void
20 testBug (void)
22 ASSERT (foo (42) == 21);