RFR: JDK-8300080: offset_of for GCC/Clang exhibits undefined behavior and is not always a compile-time constant [v3]
Justin King
jcking at openjdk.org
Fri Jan 13 14:56:44 UTC 2023
> 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.
Justin King has updated the pull request incrementally with one additional commit since the last revision:
Use parenthesis
Signed-off-by: Justin King <jcking at google.com>
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11978/files
- new: https://git.openjdk.org/jdk/pull/11978/files/3f46a86b..8d0b73c8
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11978&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11978&range=01-02
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/11978.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11978/head:pull/11978
PR: https://git.openjdk.org/jdk/pull/11978
More information about the hotspot-dev
mailing list