<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - MSVC: Segfault witch cleanupret to catchswitch"
   href="https://llvm.org/bugs/show_bug.cgi?id=25859">25859</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MSVC: Segfault witch cleanupret to catchswitch
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following IR is reduced greatly from a Rust program, and I'm not 100% sure
if it's legal. Currently when compiled, however, it will segfault. When the
call to GetProcessHeap is omitted it will not segfault oddly enough.



target triple = "i686-pc-windows-msvc"

declare i32 @_except_handler3(...)
declare x86_stdcallcc void @RaiseException(i32, i32, i32, i64*)
declare x86_stdcallcc i8* @GetProcessHeap()

define i32 @main() personality i32 (...)* @_except_handler3 {
top:
  invoke x86_stdcallcc void @RaiseException(i32 5395284, i32 0, i32 0, i64*
null)
          to label %impossible unwind label %cleanup

impossible:
  unreachable

cleanup:
  %cleanuppad = cleanuppad within none []
  %t = tail call x86_stdcallcc i8* @GetProcessHeap()
  cleanupret from %cleanuppad unwind label %catchswitch

catchswitch:
  %cs = catchswitch within none [label %catchpad] unwind to caller

catchpad:
  %cp = catchpad within %cs [i8* bitcast (i32 ()* @filter to i8*)]
  catchret from %cp to label %exit

exit:
  ret i32 101
}

define internal i32 @filter() {
entry-block:
  ret i32 1
}</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>