[LLVMdev] A beginner question

Nick Lewycky nicholas at mxc.ca
Sat Jul 4 09:06:19 PDT 2009


Carter Cheng wrote:
> I feel a bit bad for always asking beginner questions here but I am having some difficulties with a runtime error with which I could use some help diagnosing. 
> 
> 1) I am getting the assertion failure 
> 
> main: Type.cpp:1309: static llvm::PointerType* llvm::PointerType::get(const llvm::Type*, unsigned int): Assertion `ValueType && "Can't get a pointer to <null> type!"' failed.
> 
> from this line-
> 
> fields.push_back( llvm::PointerType::getUnqual(llvm::Type::Int32Ty) );
> 
> Is something needed to initialize the llvm::Type::Int32Ty?

Type::Int32Ty is a static const Type* with an initializer. You might 
need static constructors to run in order to initialize it, but in C++ 
that should require no action on your part.

It should be impossible for that line of code to cause that assertion. 
Are you sure you're blaming the right line? If so then you probably have 
a larger problem with your C++ environment, such as LLVM being 
miscompiled by your system compiler. (It's not one of the ones listed on 
llvm.org/docs/GettingStarted.html#brokengcc is it?)

Nick



More information about the llvm-dev mailing list