[llvm-bugs] [Bug 25099] New: Crash in WinEHPrepare::removeImplausibleTerminators()

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 7 11:27:51 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25099

            Bug ID: 25099
           Summary: Crash in WinEHPrepare::removeImplausibleTerminators()
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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 at AEBU0@@Z" = comdat any

; Function Attrs: uwtable
define void @"\01?bar@@YAXUA@@0 at 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 at 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 at 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 at 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 at XZ"(%struct.A* %a1) #4
  call void @"\01??1A@@QEAA at XZ"(%struct.A* %a2) #4
  ret void

ehcleanup:                                        ; preds = %invoke.cont
  %0 = cleanuppad []
  call void @"\01??1A@@QEAA at 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 at XZ"(%struct.A* %a1) #4
  cleanupret %1 unwind label %ehcleanup.6

ehcleanup.6:                                      ; preds = %ehcleanup.5
  %2 = cleanuppad []
  call void @"\01??1A@@QEAA at XZ"(%struct.A* %a2) #4
  cleanupret %2 unwind to caller
}

declare void @"\01?foo@@YAXUA@@0 at Z"(%struct.A*, %struct.A*) #1

; Function Attrs: nounwind uwtable
define linkonce_odr %struct.A* @"\01??0A@@QEAA at 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 at 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 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151007/0414ac68/attachment.html>


More information about the llvm-bugs mailing list