[LLVMbugs] [Bug 13460] New: clang crash: "Assertion in Casting.h:194 failed."

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 25 09:45:03 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13460

             Bug #: 13460
           Summary: clang crash: "Assertion in Casting.h:194 failed."
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: llvm at fortitu.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8946
  --> http://llvm.org/bugs/attachment.cgi?id=8946
preprocessed (and reduced) source causing the crash

Attached source causes clang (trunk r160726 and 3.1) to crash, while 3.0
(tags/RELEASE_30/final) works.
There are some similar open bugs but there is no builtin or typdef'd array
here. (#13440 #13195)
The code is a reduced testcase of code from polymake (.org).

clang: /myhome/software/clang/llvm/include/llvm/Support/Casting.h:194: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
llvm::FunctionType, Y = llvm::Type*, typename llvm::cast_retty<To,
From>::ret_type = llvm::FunctionType*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
...
Stack dump:
0.      Program arguments: /opt/clang/bin/clang -cc1 -emit-llvm
reduced_orbit_test.ii 
1.      <eof> parser at end of file
2.      reduced_orbit_test.cc:40:64: LLVM IR generation of declaration
'H<A<A<int> > (int, const A<int> &)>::call'
3.      reduced_orbit_test.cc:40:64: Generating code for declaration
'H<A<A<int> > (int, const A<int> &)>::call'
4.      reduced_orbit_test.cc:41:1: LLVM IR generation of compound statement
('{}')
Aborted

Backtrace:
#2  0x00000039dc030c6e in __assert_fail_base (fmt=<optimized out>,
assertion=0x31b1580 "isa<X>(Val) && \"cast<Ty>() argument of incompatible
type!\"", 
    file=0x31b1540
"/myhome/software/clang/llvm/include/llvm/Support/Casting.h", line=<optimized
out>, function=<optimized out>) at assert.c:94
#3  0x00000039dc030d12 in __GI___assert_fail (assertion=0x31b1580 "isa<X>(Val)
&& \"cast<Ty>() argument of incompatible type!\"", file=0x31b1540
"/myhome/software/clang/llvm/include/llvm/Support/Casting.h", 
    line=194, 
    function=0x31c08c0 "typename llvm::cast_retty<To, From>::ret_type
llvm::cast(const Y&) [with X = llvm::FunctionType, Y = llvm::Type*, typename
llvm::cast_retty<To, From>::ret_type = llvm::FunctionType*]")
    at assert.c:103
#4  0x0000000001271664 in llvm::cast<llvm::FunctionType, llvm::Type*>
(Val=@0x7fffffff98d0) at
/myhome/software/clang/llvm/include/llvm/Support/Casting.h:194
#5  0x00000000012bcc85 in clang::CodeGen::CodeGenFunction::EmitCall
(this=0x7fffffffa980, CallInfo=..., Callee=0x4c7da78, ReturnValue=...,
CallArgs=..., TargetDecl=0x4c7ad50, callOrInvoke=0x0)
    at /myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGCall.cpp:1927
#6  0x000000000131882e in clang::CodeGen::CodeGenFunction::EmitCall
(this=0x7fffffffa980, CalleeType=..., Callee=0x4c7da78, ReturnValue=...,
ArgBeg=..., ArgEnd=..., TargetDecl=0x4c7ad50)
    at /myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:2745
#7  0x000000000131774a in clang::CodeGen::CodeGenFunction::EmitCallExpr
(this=0x7fffffffa980, E=0x4c7c6c0, ReturnValue=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:2544
#8  0x0000000001326a02 in (anonymous namespace)::AggExprEmitter::VisitCallExpr
(this=0x7fffffffa490, E=0x4c7c6c0) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:658
#9  0x000000000132a65f in clang::StmtVisitorBase<clang::make_ptr,
{anonymous}::AggExprEmitter, void>::Visit(clang::make_ptr<clang::Stmt>::type)
(this=0x7fffffffa490, S=0x4c7c6c0)
    at
/myhome/software/clang/build/tools/clang/lib/CodeGen/../../include/clang/AST/StmtNodes.inc:259
#10 0x00000000013292a3 in clang::CodeGen::CodeGenFunction::EmitAggExpr
(this=0x7fffffffa980, E=0x4c7c6c0, Slot=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExprAgg.cpp:1258
#11 0x000000000130b85d in clang::CodeGen::CodeGenFunction::EmitAnyExpr
(this=0x7fffffffa980, E=0x4c7c6c0, aggSlot=..., ignoreResult=true) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:122
#12 0x000000000130b60d in clang::CodeGen::CodeGenFunction::EmitIgnoredExpr
(this=0x7fffffffa980, E=0x4c7c6c0) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGExpr.cpp:102
#13 0x00000000013bc006 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffa980, S=0x4c7c6c0) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:100
#14 0x00000000013bc5fb in clang::CodeGen::CodeGenFunction::EmitCompoundStmt
(this=0x7fffffffa980, S=..., GetLast=false, AggSlot=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:203
#15 0x00000000013bc3d2 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=0x7fffffffa980, S=0x4c7c950) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:175
#16 0x00000000013bbec1 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffa980, S=0x4c7c950) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:47
#17 0x00000000013d65c2 in clang::CodeGen::CodeGenFunction::EmitFunctionBody
(this=0x7fffffffa980, Args=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:468
#18 0x00000000013d6ad4 in clang::CodeGen::CodeGenFunction::GenerateCode
(this=0x7fffffffa980, GD=..., Fn=0x4c7a490, FnInfo=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:536
#19 0x0000000001245b3a in
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition (this=0x4c600a0,
GD=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1882
#20 0x00000000012429f5 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=0x4c600a0, GD=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1022
#21 0x0000000001242363 in clang::CodeGen::CodeGenModule::EmitGlobal
(this=0x4c600a0, GD=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:906
#22 0x0000000001248bbe in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x4c600a0, D=0x4c7add0) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2540
#23 0x000000000123b61f in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0x4c35570, DG=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:69
#24 0x0000000001239842 in clang::BackendConsumer::HandleTopLevelDecl
(this=0x4c351b0, D=...) at
/myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:103
#25 0x00000000013fcbb6 in clang::ParseAST (S=..., PrintStats=false,
SkipFunctionBodies=false) at
/myhome/software/clang/llvm/tools/clang/lib/Parse/ParseAST.cpp:100
#26 0x0000000001063b68 in clang::ASTFrontendAction::ExecuteAction
(this=0x4c09bc0) at
/myhome/software/clang/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:418
#27 0x0000000001238c5a in clang::CodeGenAction::ExecuteAction (this=0x4c09bc0)
at /myhome/software/clang/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:421
#28 0x000000000106379c in clang::FrontendAction::Execute (this=0x4c09bc0) at
/myhome/software/clang/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:335
#29 0x000000000103487e in clang::CompilerInstance::ExecuteAction
(this=0x4c06800, Act=...) at
/myhome/software/clang/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:672
#30 0x0000000000ffa25a in clang::ExecuteCompilerInvocation (Clang=0x4c06800) at
/myhome/software/clang/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:188
#31 0x0000000000fe23e8 in cc1_main (ArgBegin=0x7fffffffc730,
ArgEnd=0x7fffffffc740, Argv0=0x4c06678 "/opt/clang/bin/clang",
MainAddr=0xff1665)
    at /myhome/software/clang/llvm/tools/clang/tools/driver/cc1_main.cpp:165
#32 0x0000000000ff2e4d in main (argc_=4, argv_=0x7fffffffda98) at
/myhome/software/clang/llvm/tools/clang/tools/driver/driver.cpp:358

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list