[LLVMdev] uninitialized value warnings: LLVMParser.cpp

Devang Patel dpatel at apple.com
Tue Nov 9 13:59:27 PST 2010


On Nov 9, 2010, at 12:34 PM, Ted Kremenek wrote:

> These warnings started appearing recently when building LLVM:
> 
> llvm[2]: Compiling LLParser.cpp for Release build
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp: In member function ‘bool llvm::LLParser::ParseBr(llvm::Instruction*&, llvm::LLParser::PerFunctionState&)’:
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3195: warning: ‘Op1’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3195: warning: ‘Op2’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp: In member function ‘bool llvm::LLParser::ParseInvoke(llvm::Instruction*&, llvm::LLParser::PerFunctionState&)’:
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3316: warning: ‘NormalBB’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3316: warning: ‘UnwindBB’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp: In member function ‘bool llvm::LLParser::ParseSwitch(llvm::Instruction*&, llvm::LLParser::PerFunctionState&)’:
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3224: warning: ‘DefaultBB’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3239: warning: ‘DestBB’ may be used uninitialized in this function
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp: In member function ‘bool llvm::LLParser::ParseIndirectBr(llvm::Instruction*&, llvm::LLParser::PerFunctionState&)’:
> /Volumes/Data/Users/kremenek/llvm/lib/AsmParser/LLParser.cpp:3281: warning: ‘DestBB’ may be used uninitialized in this function
> 
> I thought I'd mention these in case someone was actively working on this file.  I haven't taken a look at the warnings yet.

They are like

void foo(int *&p, int k) {
  if (k) p=p+1;
  else p=0;
}

...
  int *p;
  foo(p, 0);
...






More information about the llvm-dev mailing list