Surinder
2011-Jan-31 04:55 UTC
[LLVMdev] llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.
I have written a new pass, it compiles ok but crashes when i run it with error (llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.). The pass is : using namespace llvm; namespace { struct Dfl : public FunctionPass { static char ID; Dfl() : FunctionPass(ID) { } virtual bool runOnFunction(Function &F) { bool modified=false; errs() << "In Dfl for Function : " << F.getName(); if (F.empty()) errs() << " is empty." << "\n"; else errs() << "\n"; return modified; }; // pass interface to other passes virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired<DominatorTree>(); } }; // end struc Dfl // Identifier variable for the pass char Dfl::ID = 0; // Register the pass static RegisterPass<Dfl> X("dfl","emit cfg in dfl format" , false, false); }
Surinder
2011-Jan-31 04:57 UTC
[LLVMdev] llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.
llvm/include/llvm/Pass.h:93: llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed. On Mon, Jan 31, 2011 at 3:55 PM, Surinder <surifilms at gmail.com> wrote:> I have written a new pass, it compiles ok but crashes when i run it > with error (llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid > && "pid cannot be 0"' failed.). > > The pass is : > > using namespace llvm; > namespace > { > struct Dfl : public FunctionPass { > static char ID; > Dfl() : FunctionPass(ID) { } > virtual bool runOnFunction(Function &F) { > bool modified=false; > errs() << "In Dfl for Function : " << F.getName(); > if (F.empty()) errs() << " is empty." << "\n"; > else errs() << "\n"; > return modified; > }; > // pass interface to other passes > virtual void getAnalysisUsage(AnalysisUsage &AU) const { > AU.setPreservesAll(); > AU.addRequired<DominatorTree>(); > } > }; // end struc Dfl > // Identifier variable for the pass > char Dfl::ID = 0; > // Register the pass > static RegisterPass<Dfl> X("dfl","emit cfg in dfl format" > , false, false); > } >
Surinder
2011-Jan-31 05:34 UTC
[LLVMdev] llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.
Got the solution, &ID and not ID should be passed to Dfl() : FunctionPass(&ID) { } On Mon, Jan 31, 2011 at 3:57 PM, Surinder <surifilms at gmail.com> wrote:> llvm/include/llvm/Pass.h:93: llvm::Pass::Pass(llvm::PassKind, > intptr_t): Assertion `pid && "pid cannot be 0"' failed. > > > On Mon, Jan 31, 2011 at 3:55 PM, Surinder <surifilms at gmail.com> wrote: >> I have written a new pass, it compiles ok but crashes when i run it >> with error (llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid >> && "pid cannot be 0"' failed.). >> >> The pass is : >> >> using namespace llvm; >> namespace >> { >> struct Dfl : public FunctionPass { >> static char ID; >> Dfl() : FunctionPass(ID) { } >> virtual bool runOnFunction(Function &F) { >> bool modified=false; >> errs() << "In Dfl for Function : " << F.getName(); >> if (F.empty()) errs() << " is empty." << "\n"; >> else errs() << "\n"; >> return modified; >> }; >> // pass interface to other passes >> virtual void getAnalysisUsage(AnalysisUsage &AU) const { >> AU.setPreservesAll(); >> AU.addRequired<DominatorTree>(); >> } >> }; // end struc Dfl >> // Identifier variable for the pass >> char Dfl::ID = 0; >> // Register the pass >> static RegisterPass<Dfl> X("dfl","emit cfg in dfl format" >> , false, false); >> } >> >
Seemingly Similar Threads
- [LLVMdev] llvm::Pass::Pass(llvm::PassKind, intptr_t): Assertion `pid && "pid cannot be 0"' failed.
- [LLVMdev] Error : llvm/include/llvm/Pass.h:188: error: incomplete type 'llvm::DominatorTree' used in nested name specifier
- [LLVMdev] Error : llvm/include/llvm/Pass.h:188: error: incomplete type 'llvm::DominatorTree' used in nested name specifier
- [LLVMdev] LLVM grammar for ANTLR
- [LLVMdev] LLVM grammar for ANTLR