<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 --- - [WinEH] assertion when inlining function into cleanuppad"
   href="https://llvm.org/bugs/show_bug.cgi?id=26263">26263</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[WinEH] assertion when inlining function into cleanuppad
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>r.sagitario@gmx.de
          </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>Created <span class=""><a href="attachment.cgi?id=15696" name="attach_15696" title="original IR before reduction by bugpoint">attachment 15696</a> <a href="attachment.cgi?id=15696&action=edit" title="original IR before reduction by bugpoint">[details]</a></span>
original IR before reduction by bugpoint

The attached IR produces an assertion when optimized with -O2:

Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!",
file C:\s\d\ldc\llvm\include\llvm/Support/Casting.h, line 223

bugpoint reduces this to:

; ModuleID = 'bugpoint-reduced-simplified.bc'
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc"

define x86_stdcallcc void @"\01__D5sdt123S126__dtorMFZv"() {
  ret void
}

define x86_stdcallcc void @"\01__D5sdt125foo12FS5sdt123S12Zv"() {
  ret void
}

define x86_stdcallcc void @"\01__D5sdt126test12FZv"() personality i32 (i8*,
i8*, i8*, i8*)* @__CxxFrameHandler3 {
  invoke x86_stdcallcc void @"\01__D5sdt125foo12FS5sdt123S12Zv"()
          to label %postinvoke unwind label %cleanuppad

postinvoke:                                       ; preds = %0
  br i1 undef, label %assertPassed, label %assertFailed

cleanuppad:                                       ; preds = %0
  %1 = cleanuppad within none []
  br i1 undef, label %finally1, label %cleanupret

finally1:                                         ; preds = %cleanuppad
  br label %cleanupret

cleanupret:                                       ; preds = %finally1,
%cleanuppad
  cleanupret from %1 unwind to caller

assertPassed:                                     ; preds = %postinvoke
  ret void

assertFailed:                                     ; preds = %postinvoke
  unreachable
}

declare i32 @__CxxFrameHandler3(i8*, i8*, i8*, i8*)

!llvm.ident = !{!0}

!0 = !{!"ldc version 1598c4"} 

and blames the -prune-eh pass. "opt -prune-eh" prints:

CleanupReturnInst needs to be provided a CleanupPad
  cleanupret from undef unwind to caller
token undef
LLVM ERROR: Broken function found, compilation aborted!</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>