mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
Fix const folding of 64bit pointer constants
See testcase.
This commit is contained in:
parent
0b0e64c2c9
commit
3bc9c325c5
4
tccgen.c
4
tccgen.c
@ -1659,10 +1659,10 @@ static void gen_opic(int op)
|
||||
uint64_t l2 = c2 ? v2->c.i : 0;
|
||||
int shm = (t1 == VT_LLONG) ? 63 : 31;
|
||||
|
||||
if (t1 != VT_LLONG)
|
||||
if (t1 != VT_LLONG && (PTR_SIZE != 8 || t1 != VT_PTR))
|
||||
l1 = ((uint32_t)l1 |
|
||||
(v1->type.t & VT_UNSIGNED ? 0 : -(l1 & 0x80000000)));
|
||||
if (t2 != VT_LLONG)
|
||||
if (t2 != VT_LLONG && (PTR_SIZE != 8 || t2 != VT_PTR))
|
||||
l2 = ((uint32_t)l2 |
|
||||
(v2->type.t & VT_UNSIGNED ? 0 : -(l2 & 0x80000000)));
|
||||
|
||||
|
@ -946,6 +946,12 @@ void expr_ptr_test()
|
||||
j = -1;
|
||||
printf("%d\n", sp[j].i);
|
||||
}
|
||||
#ifdef __LP64__
|
||||
i = 1;
|
||||
p = (int*)0x100000000UL + i;
|
||||
i = ((long)p) >> 32;
|
||||
printf("largeptr: %p %d\n", p, i);
|
||||
#endif
|
||||
}
|
||||
|
||||
void expr_cmp_test()
|
||||
|
Loading…
Reference in New Issue
Block a user