[cfe-dev] Kaleidoscope Debug Assertion

Patrick Flannery foster_flannery at yahoo.com
Sun Jun 13 18:32:11 PDT 2010


When running Kaleidoscope[1-7]  from svn head (105926) in Debug mode I receive the following assertion. 

Assertion failed: (C1->getType()->isIntOrIntVectorTy() && "Tried to create an integer operation on a non-integer type!"), function get, file Constants.cpp, line 1460.

Program received signal SIGABRT, Aborted.
0x93e33e42 in __kill ()
(gdb) where
#0  0x93e33e42 in __kill ()
#1  0x93e33e34 in kill$UNIX2003 ()
#2  0x93ea623a in raise ()
#3  0x93eb2679 in abort ()
#4  0x93ea73db in __assert_rtn ()
#5  0x005422da in llvm::ConstantExpr::get (Opcode=8, C1=0x150d7e0, C2=0x150d810, Flags=0) at Constants.cpp:1459
#6  0x00542ade in llvm::ConstantExpr::getAdd (C1=0x150d7e0, C2=0x150d810) at Constants.cpp:1859
#7  0x00004ca8 in llvm::ConstantFolder::CreateAdd (this=0x72082c, LHS=0x150d7e0, RHS=0x150d810) at Support/ConstantFolder.h:37
#8  0x000091dd in llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateAdd (this=0x720818, LHS=0x150d7e0, RHS=0x150d810, Name=@0xbffff54c) at Support/IRBuilder.h:324
#9  0x0000470b in BinaryExprAST::Codegen (this=0x150d2d0) at toy.cpp:670
#10 0x00004596 in BinaryExprAST::Codegen (this=0x150d320) at toy.cpp:665
#11 0x000036c7 in FunctionAST::Codegen (this=0x150d330) at toy.cpp:977
#12 0x00003796 in HandleDefinition () at toy.cpp:1006
#13 0x000038eb in MainLoop () at toy.cpp:1053
#14 0x00003bb8 in main () at toy.cpp:1131

I believe the issue is that an integer add/sub/mult/div IR instruction is being emitted when an fadd/fsub/fmul should be.  I have attached a patch which fixes the assertion. 



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100613/36ab582d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Kaleidoscope.diff
Type: application/octet-stream
Size: 3000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100613/36ab582d/attachment.obj>


More information about the cfe-dev mailing list