Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

icpc compiler and bounds checking

jmorgie
Beginner
534 Views
I want to turn on bounds checking when I compile using icpc. to perform runtime bounds checkking on arrays. [program is mixed C and C++ modules, several static arrays]

modules loaded: intel/cce_11.1.046 and intel/fce_11.1.046

when I search icpc and bounds checking online i find that variously says to use:

-CB
-check
-bounds
-Mbounds


alas, none of these are recognized by my compiler.

So here is the question:
* is it still possible to do run time bounds checking of arrays ?
* if so, what is the option flag?
* if so, have our system engineers failed to install or add pieces to the compiler ? what should I tell them to do ?
* what am I missing ?

thanks
0 Kudos
1 Reply
Melanie_B_Intel
Employee
534 Views

Hi,

Are you compiling on Windows, Mac, or Linux host?

Intel C++ Compiler for Windows supports compatability with Microsoft C++ compiler options. The option to enable runtime checks, on Windows, may be specified by the compiler option
/RTC

Windows RTC runtime checks are supported for local arrays, not static arrays.

The option /RTC is available only on Windows.

On Linux/Mac, you might find the option -fstack-security-check to be useful. According to thecompiler documentation "This option determines whether the compiler generates code that detects some buffer overruns that overwrite the return address. This is a common technique for exploiting code that does not enforce buffer size restrictions."

Generally speaking, array indexing checking, as is available in languages like Java, Adaand Fortran, is not available in C++.

You may want to repost your question on a different forum: Intel C++ Compiler

Regards

0 Kudos
Reply