awilfox wrote:

> This violates aliasing rules and doesn't work at all on big-endian 64-bit 
> systems where the pointer is stored in the second four bytes of the uint64_t.

Your sizes aren't correct in the description here.  This issue occurs on big 
endian 32-bit systems, and the pointer is stored in the lower bits, which are 
lost because of using address-of when turning the 64-bit number into a pointer. 
 i.e. storing 0x12345678 yields:

```
|---------------------------|
| XXXX | XXXX | 1234 | 5678 |
|---------------------------|
```

If you just cast down to a `uintptr_t` (or such), you get the correct value.  
But if you point to the *address of* this 64-bit value, and access a 32-bit 
value, you receive the `XXXX'XXXX` instead of `1234'5678`.

https://github.com/llvm/llvm-project/pull/112806
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to