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

Pointer Checker in ICC: requires dynamic linking of runtime libraries

$
0
0

The -check-pointers switch, which enables the Pointer Checker feature, cannot be used with the -static flag on Linux* (/MT on Windows*) which forces all Intel libraries to be linked statically. The reason is that, by design, the Pointer Checker library “libchkp.so” must be shared by all executables and libraries in a process without duplication. While it is certainly possible to ensure, manually, that only a single library copy is linked, we found in testing that it was quite easy for users to accidentally include multiple copies of the library, causing unpredictable runtime errors. For this reason, we do not allow use of -static (or /MT) with Pointer Checker. 

If the Linux system linker “ld” is used to link programs that have been compiled with -check-pointers, the libchkp.so and libchkpwrap.a libraries must be included. They are typically found in the /opt/intel/composerxe/lib/intel64 or ia32 directories. Or, if the “icc” or “icpc” compiler drivers are used to link, these libraries will be automatically included if the “-check-pointers:rw” or “-check-pointers:write” switches is used.

Examples:

icc -o executable -check-pointers:rw a.o b.o c.o

or

ld -o executable a.o b.o c.o -L/opt/intel/composerxe/lib/intel64 -lchkp -lchkpwrap

If program code that is compiled with -check-pointers, calls code that is not compiled with -check-pointers, and the callee code may modify pointers in the caller, the compiler will make conservative assumptions and inaccurate results may occur. Therefore it is strongly recommended that related program units all be compiled with the same Pointer Checker options. Typical C and C++ library calls such as memcpy(), new, etc. are converted by the compiler to Pointer Checker compatible versions automatically, and do not need special treatment.

Note: With –static-intel switch, the compiler will just link in the dynamic Pointer Checker run time libraries (issuing a message to that effect) while the use of -static option will error out at link time.

  • pointer checker
  • Desarrolladores
  • Socios
  • Profesores
  • Estudiantes
  • Linux*
  • Microsoft Windows* (XP, Vista, 7)
  • Microsoft Windows* 8
  • Unix*
  • C/C++
  • Principiante
  • Intermedio
  • Intel® C++ Compiler
  • Intel® Memory Protection Extensions
  • Herramientas de desarrollo
  • Dirección URL
  • Temas de compilador

  • Viewing all articles
    Browse latest Browse all 1616

    Trending Articles



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