RFR: JDK-8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant
Kim Barrett
kbarrett at openjdk.org
Fri Jan 13 09:43:13 UTC 2023
On Thu, 12 Jan 2023 20:36:31 GMT, Justin King <jcking at 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.
>
> @aph FYI undoes `offset_of` change from JDK-8294902
Also @jcking , please always assign a subcompent for hotspot bugs in JBS. I moved this one to the runtime subcomponent.
-------------
PR: https://git.openjdk.org/jdk/pull/11978
More information about the build-dev
mailing list