[LLVMbugs] [Bug 24196] New: EH: clang fails on assertion on complex doubles multiplication when EH is enabled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 21 05:06:18 PDT 2015


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

            Bug ID: 24196
           Summary: EH: clang fails on assertion on complex doubles
                    multiplication when EH is enabled
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: d.zobnin.bugzilla at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat test.cpp

struct A {
  int x;
  A() { x = 10; }
  ~A() { x = 20; }
};
int main() {
  {
    A a;
    double __complex__ d;
    double __complex__ d1 = d * d;
  }
  return 0;
}

$ clang -cc1 -fexceptions -fcxx-exceptions -O0 -emit-llvm test.cpp -o test.ll

llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X,
Y*>::ret_type llvm::cast(Y*) [with X = llvm::CallInst; Y = llvm::Instruction;
typename llvm::cast_retty<X, Y*>::ret_type = llvm::CallInst*]: Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

Stack trace leads us to the function
ComplexExprEmitter::EmitComplexBinOpLibCall in file
llvm/tools/clang/lib/CodeGen/CGExprComplex.cpp, line:
cast<llvm::CallInst>(Call)->setCallingConv(CGF.CGM.getBuiltinCC());

This issue occurs due to EH enabling if landing pad is required at the moment
of complex numbers multiplication (Call is not actually a llvm::CallInst*, but
llvm::InvokeInst*).

I will handle this case.

Denis Zobnin
=============
Software Engineer
Intel Compiler Team
Intel

-- 
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/20150721/a921e760/attachment.html>


More information about the llvm-bugs mailing list