On Thu, 12 Jan 2023 20:28:50 GMT, Justin King <jck...@openjdk.org> wrote:

> The implementation of `offset_of` for GCC/Clang only deals with types are 
> aligned to 16 bytes or less, if they are more, such as `zCollectedHeap` the 
> behavior is undefined. UBSan also suggests that `offset_of` is not always a 
> compile time constant, as the stack trace came from the dynamic loader during 
> library loading. This patch changes `offset_of` to use `offsetof` and 
> disables the warning `invalid-offsetof` for the JVM.

Please don't make this change.  We are intentionally not using offsetof.  See 
JDK-8239357.

A change to the existing code would be to use `alignof(klass)` to align the 
space buffer, once use of
`alignof` is approved.  That would fix the alignment problem.

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

PR: https://git.openjdk.org/jdk/pull/11978

Reply via email to