<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 --- - Verify error: Unwind edges out of a funclet pad must have the same unwind dest"
   href="https://llvm.org/bugs/show_bug.cgi?id=26147">26147</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Verify error: Unwind edges out of a funclet pad must have the same unwind dest
          </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>Scalar Optimizations
          </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>When running the IR below through `opt -inline` it will generate the error

Unwind edges out of a funclet pad must have the same unwind dest
  %pad2.i = cleanuppad within none []
  cleanupret from %pad2.i unwind label %bad1.i
  invoke void @external() [ "funclet"(token %pad2.i) ]
          to label %.noexc unwind label %bad
LLVM ERROR: Broken function found, compilation aborted!

---

; ModuleID = 'foo.ll'
target triple = "x86_64-pc-windows-msvc"

declare i32 @__C_specific_handler(...)

declare void @external()

define void @foo(i8*) personality i32 (...)* @__C_specific_handler {
start:
  invoke void @bar(i8* %0)
          to label %good unwind label %bad

good:                                             ; preds = %start
  ret void

bad:                                              ; preds = %start
  %pad = cleanuppad within none []
  cleanupret from %pad unwind to caller
}

define internal void @bar(i8*) personality i32 (...)* @__C_specific_handler {
start:
  invoke void @external()
          to label %ok1 unwind label %bad1

ok1:                                              ; preds = %start
  invoke void @external()
          to label %ok2 unwind label %bad2

ok2:                                              ; preds = %ok1
  ret void

bad2:                                             ; preds = %ok1
  %pad2 = cleanuppad within none []
  call void @external() [ "funclet"(token %pad2) ]
  cleanupret from %pad2 unwind label %bad1

bad1:                                             ; preds = %bad2, %start
  %pad1 = cleanuppad within none []
  cleanupret from %pad1 unwind to caller
}</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>