<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 --- - Crash in WinEHPrepare::removeImplausibleTerminators()"
href="https://llvm.org/bugs/show_bug.cgi?id=25099">25099</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Crash in WinEHPrepare::removeImplausibleTerminators()
</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>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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rnk@google.com
</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>This C++ source triggers the issue currently:
struct A {
A(const A &a) {}
~A();
};
void foo(A a1, A a2);
void bar(A a1, A a2) { foo(a1, a2); }
We end up with an empty FuncletPadBB in this code snippet:
BasicBlock *FuncletPadBB = Funclet.first;
std::set<BasicBlock *> &BlocksInFunclet = Funclet.second;
Instruction *FirstNonPHI = FuncletPadBB->getFirstNonPHI(); //
getFirstNonPhi returns null
auto *CatchPad = dyn_cast<CatchPadInst>(FirstNonPHI); // dyn_cast of null
crashes
This IR reproduces the problem with llc:
; ModuleID = 't.cpp'
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc18.0.0"
%struct.A = type { i8 }
$"\01??0A@@QEAA@AEBU0@@Z" = comdat any
; Function Attrs: uwtable
define void @"\01?bar@@YAXUA@@0@Z"(%struct.A* %a1, %struct.A* %a2) #0
personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
%agg.tmp = alloca %struct.A, align 1
%agg.tmp1 = alloca %struct.A, align 1
%call = invoke %struct.A* @"\01??0A@@QEAA@AEBU0@@Z"(%struct.A* %agg.tmp,
%struct.A* dereferenceable(1) %a2)
to label %invoke.cont unwind label %ehcleanup.5
invoke.cont: ; preds = %entry
%call3 = invoke %struct.A* @"\01??0A@@QEAA@AEBU0@@Z"(%struct.A* %agg.tmp1,
%struct.A* dereferenceable(1) %a1)
to label %invoke.cont.2 unwind label %ehcleanup
invoke.cont.2: ; preds = %invoke.cont
invoke void @"\01?foo@@YAXUA@@0@Z"(%struct.A* %agg.tmp1, %struct.A* %agg.tmp)
to label %invoke.cont.4 unwind label %ehcleanup.5
invoke.cont.4: ; preds = %invoke.cont.2
call void @"\01??1A@@QEAA@XZ"(%struct.A* %a1) #4
call void @"\01??1A@@QEAA@XZ"(%struct.A* %a2) #4
ret void
ehcleanup: ; preds = %invoke.cont
%0 = cleanuppad []
call void @"\01??1A@@QEAA@XZ"(%struct.A* %agg.tmp) #4
cleanupret %0 unwind label %ehcleanup.5
ehcleanup.5: ; preds = %invoke.cont.2,
%ehcleanup, %entry
%1 = cleanuppad []
call void @"\01??1A@@QEAA@XZ"(%struct.A* %a1) #4
cleanupret %1 unwind label %ehcleanup.6
ehcleanup.6: ; preds = %ehcleanup.5
%2 = cleanuppad []
call void @"\01??1A@@QEAA@XZ"(%struct.A* %a2) #4
cleanupret %2 unwind to caller
}
declare void @"\01?foo@@YAXUA@@0@Z"(%struct.A*, %struct.A*) #1
; Function Attrs: nounwind uwtable
define linkonce_odr %struct.A* @"\01??0A@@QEAA@AEBU0@@Z"(%struct.A* returned
%this, %struct.A* dereferenceable(1) %a) unnamed_addr #2 comdat align 2 {
entry:
%a.addr = alloca %struct.A*, align 8
%this.addr = alloca %struct.A*, align 8
store %struct.A* %a, %struct.A** %a.addr, align 8
store %struct.A* %this, %struct.A** %this.addr, align 8
%this1 = load %struct.A*, %struct.A** %this.addr, align 8
ret %struct.A* %this1
}
declare i32 @__CxxFrameHandler3(...)
; Function Attrs: nounwind
declare void @"\01??1A@@QEAA@XZ"(%struct.A*) #3
attributes #0 = { uwtable "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
"target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #2 = { nounwind uwtable "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #3 = { nounwind "disable-tail-calls"="false"
"less-precise-fpmad"="false" "no-frame-pointer-elim"="false"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+sse,+sse2" "unsafe-fp-math"="false"
"use-soft-float"="false" }
attributes #4 = { nounwind }</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>