<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - Clang generates stacksave/stackrestore incorrectly when a loop has VLA and alloca"
   href="https://llvm.org/bugs/show_bug.cgi?id=30229">bug 30229</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;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>rnk@google.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>DUPLICATE
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - Clang generates stacksave/stackrestore incorrectly when a loop has VLA and alloca"
   href="https://llvm.org/bugs/show_bug.cgi?id=30229#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - Clang generates stacksave/stackrestore incorrectly when a loop has VLA and alloca"
   href="https://llvm.org/bugs/show_bug.cgi?id=30229">bug 30229</a>
              from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
        <pre>This is a well-known issue that's basically infeasible to fix without seriously
violating user expectations in some way.

GCC's new behavior also seems surprising, and could easily lead to stack
overflow in your example.

The other way to fix this it to have alloca call malloc behind the scenes in
this situation. However, oftentimes users are using alloca because they are
trying to avoid malloc for async signal safety reasons.

If you don't mind, I'm going to dupe against the old bug. What's new is that
GCC has decided to make this code work.

*** This bug has been marked as a duplicate of <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - if a loop body contains both a VLA and a call to alloca, we still generate stacksave/stackrestore"
   href="show_bug.cgi?id=16099">bug 16099</a> ***</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>