What to do: clang-4.0 fastdebug assertion failure in os_linux_x86:os::verify_stack_alignment()

Christian Thalinger cthalinger at twitter.com
Wed Jul 11 14:34:20 UTC 2018

> On Jul 9, 2018, at 10:53 PM, Martin Buchholz <martinrb at google.com> wrote:
> There's only one remaining problem building latest jdk with latest clang on
> Linux preventing it from working out of the box.  It seems likely macosx
> has the same problem.
> https://bugs.openjdk.java.net/browse/JDK-8186780
> clang-4.0 fastdebug assertion failure in
> os_linux_x86:os::verify_stack_alignment()
> Verifying stack alignment seems rather fragile, especially in the presence
> of inlining.
> There are various things we can do:
> - making os::verify_stack_alignment NOINLINE and/or moving
> os::verify_stack_alignment
> to its own translation unit.
> - simply disabling the stack alignment check for clang
> - I don't see any reason why esp should be aligned even if stack frames
> are.  (Maybe ebp is better?  I'm not a x86 assembly programmer) More
> principled seems invoking functions recursively and disabling inlining and
> checking that the difference between addresses of a local is a multiple of
> the alignment, but that will get complicated.
> - why does stack alignment even matter? Isn't it the alignment of c++
> objects on the stack that matter?

C++ compilers can (and actually do) emit instructions that need alignment, like movaps.  I’ve seen many crashes in the past with movaps and an unaligned stack coming from JIT or stub code.

More information about the hotspot-runtime-dev mailing list