RFR: 8346714: [ASAN] compressedKlass.cpp reported applying non-zero offset to null pointer [v2]

Thomas Stuefe stuefe at openjdk.org
Sat Dec 21 10:59:34 UTC 2024


On Fri, 20 Dec 2024 15:41:46 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> Thanks for fixing the issue! This should work. In general, I still prefer using `uintptr_t` because `intptr_t` has undefined behavior on overflow. Probably not in this case, here.

+1. Also, instead of casting manually, please use p2u (and if there is none, we should add it like we have a p2i for intptr_t).

I am somewhat unenthusiastic about changes like these. We seem to add a lot of casting boilerplate to satisfy UBsan for the sake of cleanliness that only matters on special hardware that treats pointers differently from numeric. Like old-style IBM AS/400s. But if we ever build for that kind of hardware, nothing will work anyway. I am happy to be corrected, though, but I think all our compilers treat NULL as numeric 0, right?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22848#issuecomment-2558083084


More information about the hotspot-dev mailing list