History

Fix const folding of 64bit pointer constants

See testcase.

Michael Matz committed 10 years ago

Commit 3bc9c321 parent 0b0e64c2 files · +8 −2Browse files

Unified · Split

2 files
  1. tccgen.c +2 −2
  2. tests/tcctest.c +6 −0
tccgen.c+2−2
@@ -1659,10 +1659,10 @@ static void gen_opic(int op) · 1658 unmodified lines
1659 uint64_t l2 = c2 ? v2->c.i : 0;1659 uint64_t l2 = c2 ? v2->c.i : 0;
1660 int shm = (t1 == VT_LLONG) ? 63 : 31;1660 int shm = (t1 == VT_LLONG) ? 63 : 31;
1661 1661
1662 if (t1 != VT_LLONG)1662 if (t1 != VT_LLONG && (PTR_SIZE != 8 || t1 != VT_PTR))
1663 l1 = ((uint32_t)l1 |1663 l1 = ((uint32_t)l1 |
1664 (v1->type.t & VT_UNSIGNED ? 0 : -(l1 & 0x80000000)));1664 (v1->type.t & VT_UNSIGNED ? 0 : -(l1 & 0x80000000)));
1665 if (t2 != VT_LLONG)1665 if (t2 != VT_LLONG && (PTR_SIZE != 8 || t2 != VT_PTR))
1666 l2 = ((uint32_t)l2 |1666 l2 = ((uint32_t)l2 |
1667 (v2->type.t & VT_UNSIGNED ? 0 : -(l2 & 0x80000000)));1667 (v2->type.t & VT_UNSIGNED ? 0 : -(l2 & 0x80000000)));
1668 1668
tests/tcctest.c+6−0
@@ -946,6 +946,12 @@ void expr_ptr_test() · 945 unmodified lines
946 j = -1;946 j = -1;
947 printf("%d\n", sp[j].i);947 printf("%d\n", sp[j].i);
948 }948 }
949#ifdef __LP64__
950 i = 1;
951 p = (int*)0x100000000UL + i;
952 i = ((long)p) >> 32;
953 printf("largeptr: %p %d\n", p, i);
954#endif
949}955}
950 956
951void expr_cmp_test()957void expr_cmp_test()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t