[LLVMdev] Seeing a crash with ConstantFP::get

Dale Johannesen dalej at apple.com
Wed Sep 5 14:38:39 PDT 2007


On Sep 5, 2007, at 2:21 PM, Chuck Rose III wrote:

> Hola LLVMers,
>
>
>
> I’m getting a crash when using ConstantFP::get.
>
>
>
> I can repro it by adding one line to the Fibonacci example program:
>
>
>
> int main(int argc, char **argv) {
>
>   int n = argc > 1 ? atol(argv[1]) : 24;
>
>
>
>   // Create some module to put our function into it.
>
>   Module *M = new Module("test");
>
>
>
>   // We are about to create the "fib" function:
>
>   Function *FibF = CreateFibFunction(M);
>
>
>
> // add the following line
>
>   Constant* C = ConstantFP::get(Type::FloatTy,0.0);
>
>
>
>
>
> Can someone verify this?  This is on the PC side of my system which  
> I build with the VStudio files.  I don’t know if the Mac side sees  
> this as well, but I’ll try and verify.  Seems really odd to have  
> something this basic crash me.  It came up because the JITter will  
> call ConstantFP::get with the GenericValue arguments passed it, but  
> the above repro is a lot simpler and is independent of the JITter.
>
>
>
> My call stack looks like this:
>
>
>
>             in here it fails this:  assert(category == fcNormal ||  
> category == fcNaN);
>
>             Fibonacci.exe!llvm::APFloat::significandParts()  Line  
> 360 + 0x39 bytes    C++
>
>             Fibonacci.exe!llvm::APFloat::zeroSignificand()  Line  
> 387 + 0x15 bytes     C++
I've been working in this area and probably introduced this, but I  
don't see how:  zeroSignificand() sets 'category' to fcNormal before  
calling significandParts, so I don't see how that assert could be  
triggered.   The call stack looks normal for that source line.  It  
doesn't appear on the Mac.   Could your compiler be misoptimizing the  
code?
>             Fibonacci.exe!llvm::APFloat::APFloat(const  
> llvm::fltSemantics & ourSemantics={...}, unsigned __int64 value=1)   
> Line 307       C++
>
>             Fibonacci.exe!`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::getEmptyKey()  Line 277 + 0x11  
> bytes         C++
>
>             Fibonacci.exe!llvm::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo>::getEmptyKey()  Line 236 +  
> 0x9 bytes          C++
>
>             Fibonacci.exe!llvm::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo>::init(unsigned int  
> InitBuckets=64)  Line 295 + 0x9 bytes         C++
>
>             Fibonacci.exe!llvm::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo>::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo>(unsigned int  
> NumInitBuckets=64)  Line 68      C++
>
>             Fibonacci.exe! 
> llvm::ManagedStatic<llvm::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo> >::LazyInit()  Line 72 +  
> 0x24 bytes     C++
>
>             Fibonacci.exe! 
> llvm::ManagedStatic<llvm::DenseMap<`anonymous  
> namespace'::DenseMapAPFloatKeyInfo::KeyTy,llvm::ConstantFP  
> *,A0x5b1fa632::DenseMapAPFloatKeyInfo> >::operator*()  Line 55  C++
>
>             Fibonacci.exe!llvm::ConstantFP::get(const llvm::Type *  
> Ty=0x01b352d8, double V=0.00000000000000000)  Line 299 + 0xe  
> bytes          C++
>
>             Fibonacci.exe!main(int argc=1, char * *  
> argv=0x01b35060)  Line 99 + 0x13 bytes  C++
>
>             Fibonacci.exe!__tmainCRTStartup()  Line 586 + 0x19  
> bytes         C
>
>             Fibonacci.exe!mainCRTStartup()  Line 403          C
>
>
>
> Thanks,
>
> Chuck.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070905/df1c779d/attachment.html>


More information about the llvm-dev mailing list