PVS-StudioWarnings

PVS-Studio warning V522 for dmd-project

Nov 20th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. Expression *getVarExp(Loc loc, InterState *istate,
  2.                       Declaration *d, CtfeGoal goal)
  3. {
  4.   ....
  5.   VarDeclaration *v = d->isVarDeclaration();
  6.   if (v)
  7.   {
  8.     ....
  9.   }
  10.   else if (s)
  11.   {
  12.     if (s->dsym->toInitializer() == s->sym)
  13.       ....
  14.     else
  15.       error(loc,
  16.             "cannot interpret symbol %s at compile time",
  17.             v->toChars());
  18.   }
  19.   ....
  20. }
  21.  
  22. This suspicious code was found in dmd-project project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V522 Dereferencing of the null pointer 'v' might take place. interpret.c 1711
  25.  
  26. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment