Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

problem with memcpy()

$
0
0

Hi. 

I recently updated Intel compiler to version 14.0.2.176 [IA-32] on Windows. One of the projects started to generate runtime errors. After debugging, I isolated the problem to a memcpy "call".  The relevant part of the code is:

  float  mat[3][3];
  float  mataux[3][3] ;

....

  memcpy(mataux, mat,sizeof(mataux));

...

That routine have not changed for years. If I compile with the previous version of the compiler, or if compile for debug, or if I change to memmove() or if I copy the matrix elements with a loop, the problem vanished. Also, if other compiler is used, the problem vanished too.

In fact, the compiler is not calling the __intel_fast_memcpy  , it is generating an inlined version of memcpy(). See the ASM listing of the generated code :

;;;
;;;   memcpy(mataux, mat,sizeof(mataux));

        movaps    xmm1, XMMWORD PTR [100+esp]                   ;1460.3
$LN4593:
        movaps    XMMWORD PTR [148+esp], xmm1                   ;1460.3
$LN4594:
        movaps    xmm5, XMMWORD PTR [116+esp]                   ;1460.3
$LN4595:
        movaps    XMMWORD PTR [164+esp], xmm5                   ;1460.3
$LN4596:
        mov       edi, DWORD PTR [132+esp]                      ;1460.3
$LN4597:
        mov       DWORD PTR [180+esp], edi                      ;1460.3
$LN4598:

 

In other parts of the code where memcpy is generating the call to __intel_fast_memcpy, there is no problem.

Additional information:

Compiler switches :

/c /O3 /Ob2 /Oi /Ot /Oy /Qip /GA /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "MYSDL_MEVIS" /D "___MNPS_PROJECT___" /D "_MBCS" /MT /Zp1 /GS- /fp:fast /J /GR- /Fo"Release/" /Fd"Release/vc90.pdb" /W3 /nologo /Zi /TC /Qopenmp /QxSSE3 /Qopt-matmul- /Quse-intel-optimized-headers /fp:double /Qstd=c99 /Qrestrict /Qdiag-disable:1786,2557

Running on Windows 7 or 8 or Vista. All processors are Intel I7 of several generations.

Thanks.

Armando

 

 

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>