UBSan was triggered by the offset_of implementation for GCC/Clang defined in utilities/globalDefinitions_gcc.hpp. It only aligns the temporary buffer it uses to 16 bytes, while some structs/class require greater alignment, such as zCollectedHeap. UBSan stack trace also suggested that offset_of is not a compile-time constant as the stack trace showed that it was being called during library loading.
The comment in utilities/globalDefinitions_gcc.hpp says the offset_of was rolled to avoid a warning. I suggest we simply ignore the warning globally in the build system (pragma pushing doesn't work with precompiled headers) and just use offsetof.
The comment in utilities/globalDefinitions_gcc.hpp says the offset_of was rolled to avoid a warning. I suggest we simply ignore the warning globally in the build system (pragma pushing doesn't work with precompiled headers) and just use offsetof.
- relates to
-
JDK-8333578 Fix uses of overaligned types induced by ZCACHE_ALIGNED
- Open
-
JDK-8294902 Undefined Behavior in C2 regalloc with null references
- Resolved
-
JDK-8239357 Revert gcc implementation of offset_of
- Resolved
- links to
-
Review openjdk/jdk/11978