Repository navigation
Commit 6ee6234
committed
cachedb_perf: say uint64_t where 64 bits are meant, for ILP32 targets
The arm32 CI jobs fail to build pcache_htable.c with six -Werror errors,
while arm64 and every native job pass. The difference is not the
architecture but the data model: `unsigned long` is 64 bits on LP64 and 32
on ILP32, and two places in this file genuinely need 64.
The routing word packs the linear-hashing state as (level << 32) | split.
Declared `unsigned long`, so on arm32 or i386 every shift is undefined and
the packing collapses into itself - which is exactly what "left/right shift
count >= width of type" reports at :105, :1451, :1507, :1509 and :1599.
The SWAR tag scan is the same mistake with worse consequences.
tag_matches() memcpy()s the eight tag bytes into an `unsigned long` and
masks with 0x0101010101010101. On ILP32 the destination is four bytes -
clang says "'memcpy' will always overflow; destination buffer has size 4,
but size argument is 8" - and every constant is silently truncated, so the
filter that is supposed to reject 255 of 256 slots would return garbage
instead of failing loudly.
Both become uint64_t, which is what the code always meant. Every other
`unsigned long` here is a size or a pointer-range bound, correct under both
models, and is deliberately left alone.
No change on LP64, where the two types are the same width - the fleet
binaries differ only by the name of a type. The routing word was already
being read with __atomic_load_n; ARMv7 has LDREXD/STREXD so an 8-byte
atomic stays lock-free there, and where it is not the compiler emits a
libatomic call, which is still correct.
Verified with `gcc -m32`, which reproduces the identical six errors before
the change and none after, with the native 64-bit build clean throughout.
The other cachedb_perf sources were swept the same way and are unaffected.1 parent e7529c8 commit 6ee6234
2 files changed
Lines changed: 26 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
155 | 159 | | |
156 | 160 | | |
157 | | - | |
158 | | - | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
304 | 308 | | |
305 | 309 | | |
306 | 310 | | |
307 | | - | |
| 311 | + | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
| |||
564 | 568 | | |
565 | 569 | | |
566 | 570 | | |
567 | | - | |
| 571 | + | |
568 | 572 | | |
569 | 573 | | |
570 | 574 | | |
| |||
729 | 733 | | |
730 | 734 | | |
731 | 735 | | |
732 | | - | |
| 736 | + | |
733 | 737 | | |
734 | 738 | | |
735 | 739 | | |
| |||
897 | 901 | | |
898 | 902 | | |
899 | 903 | | |
900 | | - | |
| 904 | + | |
901 | 905 | | |
902 | 906 | | |
903 | 907 | | |
| |||
952 | 956 | | |
953 | 957 | | |
954 | 958 | | |
955 | | - | |
| 959 | + | |
956 | 960 | | |
957 | 961 | | |
958 | 962 | | |
| |||
1447 | 1451 | | |
1448 | 1452 | | |
1449 | 1453 | | |
1450 | | - | |
| 1454 | + | |
1451 | 1455 | | |
1452 | 1456 | | |
1453 | 1457 | | |
| |||
1504 | 1508 | | |
1505 | 1509 | | |
1506 | 1510 | | |
1507 | | - | |
| 1511 | + | |
1508 | 1512 | | |
1509 | | - | |
| 1513 | + | |
1510 | 1514 | | |
1511 | 1515 | | |
1512 | 1516 | | |
| |||
1596 | 1600 | | |
1597 | 1601 | | |
1598 | 1602 | | |
1599 | | - | |
| 1603 | + | |
1600 | 1604 | | |
1601 | 1605 | | |
1602 | 1606 | | |
| |||
1645 | 1649 | | |
1646 | 1650 | | |
1647 | 1651 | | |
1648 | | - | |
| 1652 | + | |
1649 | 1653 | | |
1650 | 1654 | | |
1651 | 1655 | | |
| |||
1659 | 1663 | | |
1660 | 1664 | | |
1661 | 1665 | | |
1662 | | - | |
| 1666 | + | |
1663 | 1667 | | |
1664 | 1668 | | |
1665 | 1669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
138 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| |||
0 commit comments