RFR: 8346866: [ASAN] memoryReserver.cpp reported applying non-zero offset to non-null pointer produced null pointer [v7]

Stefan Karlsson stefank at openjdk.org
Tue Jan 7 13:33:44 UTC 2025


On Tue, 7 Jan 2025 12:48:00 GMT, SendaoYan <syan at openjdk.org> wrote:

> > The last couple of changes made the code much more non-obvious to me.
> 
> Sorry for the frequent commit..
> 
> The main purpose of this PR is make UndefinedBehaviorSanitizer slient, so I convert `attach_point` to `size_t` and then revert it to `char*` again in the for-loop condition, this convert avoid UndefinedBehaviorSanitizer report 'produced null pointer', if we should use the explicitness of the pointer-based iteration path but avoid 2rd loop exit.

And now we have a bunch of casts and mixes of various types in the loop. I stand by my earlier feedback that using offsets reduces the need to make various casts and checks between offsets and pointers, and to me that is a good thing for the readability of the code.

If I interpret Kim's earlier comment I think that I dislike the pointer / offset mixing more than what Kim disliked the offset solution.

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

PR Comment: https://git.openjdk.org/jdk/pull/22897#issuecomment-2575303842


More information about the hotspot-runtime-dev mailing list