blob: 8b1d84d4fcad681278a35926790aaa2b2e3e86aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*
bug-2458.c
In backends that support 16x16->32 multiplication, there was a bug when
operands to such a multiplication were used in multiple such multiplications.
*/
#include <testfwk.h>
#ifndef __SDCC_pdk14 // Lack of memory - see RFE #606
int dummy(int x)
{
return x;
}
void dummy2(long x)
{
ASSERT(x == 42 * 42 || x == -42 * 42);
}
#endif
void testBug(void)
{
#ifndef __SDCC_pdk14 // Lack of memory
int i, j;
// Double use of i and j.
i = dummy(42);
j = dummy(42);
dummy2((long)i * (long)j);
i = -i;
dummy2((long)i * (long)j);
// Single use of i and j.
i = dummy(42);
j = dummy(42);
dummy2((long)i * (long)j);
#endif
}
|