[llvm-bugs] [Bug 42603] clang++ incorrect optimization at -O2 in OpenJDK’s stubRoutines.cpp

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 22 08:30:51 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42603

Kurt Miller <bsdkurt at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #6 from Kurt Miller <bsdkurt at gmail.com> ---
(In reply to Kurt Miller from comment #5)
> Please see attached test case. The problem is related to object being
> created with -mstack-alignment=16 and then called from another object that
> does build with -mstack-alignment=16 so the incoming stack alignment is not
> 16 byte aligned.

Type-o in above. It should have read "and then called from another object that
does *not* build with -mstack-alignment=16".

According to this comment: https://bugs.llvm.org/show_bug.cgi?id=40635#c1 it is
UB to call a function with higher stack alignment from a function with lower
stack alignment which is what is happening here. Since stubRoutines.cpp can
assume the stack is 16 byte aligned, the align_up all can be optimized away.

In OpenJDK 8u clang builds included -mstackrealign on x86_32 to address this.
Restoring this build flag in 11u corrects the issues I was seeing.

Changing status to resolved/invalid.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190722/6bb47a99/attachment.html>


More information about the llvm-bugs mailing list