PVS-StudioWarnings

PVS-Studio warning V567 for IPP Samples

Nov 18th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. template<typename T, Ipp32s size> void HadamardFwdFast(
  2.   ...., Ipp16s* pDst)
  3. {
  4.   Ipp32s *pTemp;
  5.   ...
  6.   for(j=0;j<4;j++) {
  7.     a[0] = pTemp[0*4] + pTemp[1*4];
  8.     a[1] = pTemp[0*4] - pTemp[1*4];
  9.     a[2] = pTemp[2*4] + pTemp[3*4];
  10.     a[3] = pTemp[2*4] - pTemp[3*4];
  11.     pTemp = pTemp++;
  12.  
  13.     pDst[0*4] = (Ipp16s)(a[0] + a[2]);
  14.     pDst[1*4] = (Ipp16s)(a[1] + a[3]);
  15.     pDst[2*4] = (Ipp16s)(a[0] - a[2]);
  16.     pDst[3*4] = (Ipp16s)(a[1] - a[3]);
  17.     pDst = pDst++;
  18.   }
  19.   ...
  20. }
  21.  
  22. Typical Undefined behavior!
  23.  
  24.  
  25. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V567 Undefined behavior. The 'pTemp' variable is modified while being used twice between sequence points. me umc_me_cost_func.h 168
  28.  
  29. 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