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

Martin Buchholz martinrb at google.com
Thu Jul 12 18:52:45 UTC 2018

>From the bug

I'm thinking all of this fiddling with esp is bogus, and that
os::verify_stack_alignment() is more trouble than it's worth. But I'm still
looking for something that will be approved. How about simply checking that
__builtin_frame_address(0) is always aligned, at least with clang and gcc?

 #ifndef PRODUCT
-void os::verify_stack_alignment() {
+NOINLINE void os::verify_stack_alignment() {
 #ifdef AMD64
- assert(((intptr_t)os::current_stack_pointer() &
(StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+ register void *esp;
+ __asm__("mov %%" SPELL_REG_SP ", %0":"=r"(esp));
+ // __builtin_frame_address supported by both gcc and clang
+ void *esp = __builtin_frame_address(0);
+ assert(((intptr_t)esp & (StackAlignmentInBytes-1)) == 0, "incorrect stack

More information about the hotspot-runtime-dev mailing list