<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:bsdkurt@gmail.com" title="Kurt Miller <bsdkurt@gmail.com>"> <span class="fn">Kurt Miller</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - clang++ incorrect optimization at -O2 in OpenJDK’s stubRoutines.cpp"
   href="https://bugs.llvm.org/show_bug.cgi?id=42603">bug 42603</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - clang++ incorrect optimization at -O2 in OpenJDK’s stubRoutines.cpp"
   href="https://bugs.llvm.org/show_bug.cgi?id=42603#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - clang++ incorrect optimization at -O2 in OpenJDK’s stubRoutines.cpp"
   href="https://bugs.llvm.org/show_bug.cgi?id=42603">bug 42603</a>
              from <span class="vcard"><a class="email" href="mailto:bsdkurt@gmail.com" title="Kurt Miller <bsdkurt@gmail.com>"> <span class="fn">Kurt Miller</span></a>
</span></b>
        <pre>(In reply to Kurt Miller from <a href="show_bug.cgi?id=42603#c5">comment #5</a>)
<span class="quote">> 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.</span >

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: <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Need a function attribute for stack alignment"
   href="show_bug.cgi?id=40635#c1">https://bugs.llvm.org/show_bug.cgi?id=40635#c1</a> 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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>