PVS-StudioWarnings

PVS-Studio warning V609 for VNL

Nov 18th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. integer pow_ii(integer *ap, integer *bp)
  2. {
  3.   integer pow, x, n;
  4.   unsigned long u;
  5.  
  6.   x = *ap;
  7.   n = *bp;
  8.  
  9.   if (n <= 0)
  10.   {
  11.     if (n == 0 || x == 1)
  12.       return 1;
  13.  
  14.     if (x != -1)
  15.       return x == 0 ? 1/x : 0;
  16.  
  17.     n = -n;
  18.   }
  19.   ....
  20. }
  21.  
  22. This suspicious code was found in VNL project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V609 Divide by zero. Denominator 'x' == 0. pow_ii.c 28
  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