summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3855.c
blob: 603c6064c6a4699cd387aa690198ddd0c47a578f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* bug-3855.c
   An issue in handling of unsigned _BitInt divisions triggered by generalized constant propagation.
 */
 
#include <testfwk.h>

long g(long t) {
    if(t>=2000 && t<4250)
        t=(24*t-38580)/1000;
    return t;
}

void testBug(void) {
#ifndef __SDCC_pdk14 // Lack of RAM (just by a few B - otherwise, we'd have to disable compilation of g above, too; let's hope future optimization makes this test possible for pdk14) */
    long r = g(4000);
    ASSERT( r == 57 ); // 24*4000-38580=57420
#endif
}