-compiler)Specify the compiler that you use to build your source code
Specify the compiler that you use to build your source code.
Polyspace® fully supports the most common compilers used to develop embedded
applications. See the list below. For these compilers, you can run analysis simply by
specifying your compiler and target processor. For other compilers, specify
generic as compiler name. If you face compilation errors,
explicitly define compiler-specific extensions to work around the errors.
User interface (desktop products only): In your project configuration, the option is on the Target & Compiler node.
Command line and options file: Use the option
-compiler. See Command-Line Information.
Polyspace uses this information to interpret syntax that is not part of the C/C++ Standard, but comes from language extensions.
For example, the option allows additional language keywords,
such as sfr, sbit, and bit.
If you do not specify your compiler, these additional keywords can
cause compilation errors during Polyspace analysis.
Polyspace does not actually invoke your compiler for compilation. In particular:
You cannot specify compiler flags directly in the Polyspace analysis. To emulate your compiler flags, trace your build command or manually specify equivalent Polyspace analysis options. See Specify Target Environment and Compiler Behavior (Polyspace Bug Finder).
Code Prover has a linking policy that is stricter than regular compilers. For instance, if your compiler allows declaration mismatches with specific compiler options, you cannot emulate this linking policy in Code Prover. See Troubleshoot Compilation and Linking Errors (Polyspace Code Prover).
Default: generic
genericAnalysis allows only standard syntax.
The language standard is determined by your choice for the following options:
If you do not specify a standard explicitly, the standard depends on your choice of compiler.
gnu3.4Analysis allows GCC 3.4 syntax.
gnu4.6Analysis allows GCC 4.6 syntax.
gnu4.7Analysis allows GCC 4.7 syntax.
For unsupported GCC extensions, see Limitations.
gnu4.8Analysis allows GCC 4.8 syntax.
For unsupported GCC extensions, see Limitations.
gnu4.9Analysis allows GCC 4.9 syntax.
For unsupported GCC extensions, see Limitations.
gnu5.xAnalysis allows GCC 5.x syntax. For a list of available GCC 5.x releases, see GCC releases.
If you select gnu5.x, the option Target processor type (-target) shows only a subset of targets
that are allowed for a GCC based compiler. For other targets, use the option
Generic target options.
For unsupported GCC extensions, see Limitations.
gnu6.xAnalysis allows GCC 6.x syntax. For a list of available GCC 6.x releases, see GCC releases.
If you select gnu6.x, the option Target processor type (-target) shows only a subset of targets
that are allowed for a GCC based compiler. For other targets, use the option
Generic target options.
For unsupported GCC extensions, see Limitations.
gnu7.xAnalysis allows GCC 7.x syntax. For a list of available GCC 7.x releases, see GCC releases.
If you select gnu7.x, the option Target processor type (-target) shows only a subset of targets
that are allowed for a GCC based compiler. For other targets, use the option
Generic target options.
For unsupported GCC extensions, see Limitations.
gnu8.xAnalysis allows GCC 8.x syntax. For a list of available GCC 8.x releases, see GCC releases.
If you select gnu8.x, the option Target processor type (-target) shows only a subset of targets
that are allowed for a GCC based compiler. For other targets, use the option
Generic target options.
For unsupported GCC extensions, see Limitations.
clang3.xAnalysis allows Clang 3.5, 3.6, 3.7, 3.8, and 3.9 syntax.
clang4.xAnalysis allows Clang 4.0.0, and 4.0.1 syntax.
clang5.xAnalysis allows Clang 5.0.0, 5.0.1, and 5.0.2 syntax.
visual9.0Analysis allows Microsoft® Visual C++® 2008 syntax.
visual10.0Analysis allows Microsoft Visual C++ 2010 syntax.
This option implicitly enables the option -no-stl-stubs.
visual11.0Analysis allows Microsoft Visual C++ 2012 syntax.
This option implicitly enables the option -no-stl-stubs.
visual12.0Analysis allows Microsoft Visual C++ 2013 syntax.
This option implicitly enables the option -no-stl-stubs.
visual14.0Analysis allows Microsoft Visual C++ 2015 syntax (supports Microsoft Visual Studio® update 2).
This option implicitly enables the option
-no-stl-stubs.
visual15.xAnalysis allows Microsoft Visual C++ 2017 syntax. For a list of available Microsoft Visual Studio 2017 versions, see Visual Studio 2017 Release Notes History.
This option implicitly enables the option
-no-stl-stubs.
visual16.xAnalysis allows Microsoft Visual C++ 2019 syntax. For a list of available Microsoft Visual Studio 2019 versions, see Visual Studio 2019 Release Notes History.
This option implicitly enables the option
-no-stl-stubs.
keilAnalysis allows non-ANSI® C syntax and semantics associated with the Keil™ products from ARM (www.keil.com).
iarAnalysis allows non-ANSI C syntax and semantics associated with the compilers from IAR Systems (www.iar.com).
armccAnalysis allows non-ANSI C syntax and semantics associated with the ARM® v5 compiler.
If you select armcc, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the ARM v5 compiler. See ARM v5 Compiler
(-compiler armcc).
armclangAnalysis allows non-ANSI C syntax and semantics associated with the ARM v6 compiler.
If you select armclang, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the ARM v6 compiler. See ARM v6 Compiler
(-compiler armclang).
codewarriorAnalysis allows non-ANSI C syntax and semantics associated with the NXP CodeWarrior® compiler.
If you select codewarrior, in the user interface of
the Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the NXP CodeWarrior compiler. See NXP CodeWarrior Compiler
(-compiler codewarrior).
cosmicAnalysis allows non-ANSI C syntax and semantics associated with the Cosmic compiler.
If you select cosmic, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the Comic compiler. See Cosmic Compiler
(-compiler cosmic).
diabAnalysis allows non-ANSI C syntax and semantics associated with the Wind River® Diab compiler.
If you select diab, in the user interface of the Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the NXP CodeWarrior compiler. See Diab
Compiler (-compiler diab).
greenhillsAnalysis allows non-ANSI C syntax and semantics associated with a Green Hills® compiler.
If you select greenhills, in the user interface of
the Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for a Green Hills compiler. See Green Hills Compiler
(-compiler greenhills).
iar-ewAnalysis allows non-ANSI C syntax and semantics associated with the IAR Embedded Workbench compiler.
If you select iar-ew, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the IAR Embedded Workbench compiler. See IAR Embedded Workbench
Compiler (-compiler iar-ew).
microchipAnalysis allows non-ANSI C syntax and semantics associated with the MPLAB XC8 C compiler.
If you select microchip, in the user interface of
the Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the MPLAB XC8 C compiler. See MPLAB XC8 C Compiler
(-compiler microchip).
renesasAnalysis allows non-ANSI C syntax and semantics associated with the Renesas® compiler.
If you select renesas, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the Renesas compiler. See Renesas Compiler
(-compiler renesas).
taskingAnalysis allows non-ANSI C syntax and semantics associated with the TASKING compiler.
If you select tasking,in the user interface of the Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the TASKING compiler. See TASKING Compiler (-compiler tasking).
tiAnalysis allows non-ANSI C syntax and semantics associated with the Texas Instruments™compiler.
If you select ti, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the Texas Instruments compiler. See Texas Instruments
Compiler (-compiler ti).
cosmicAnalysis allows non-ANSI C syntax and semantics associated with the compiler used in the Cosmic software development tools.
If you select cosmic, in the user interface of the
Polyspace desktop products, the option Target processor type (-target) shows only the targets that are
allowed for the Cosmic compiler.
Your compiler specification determines the values of many compiler-specific
macros. In case you want to know how Polyspace defines a specific macro, use the option -dump-preprocessing-info.
To override the macro definition, use the option Preprocessor definitions (-D).
To undefine a macro, use the option Disabled preprocessor definitions (-U).
If you use a Visual Studio compiler, you must use a Target
processor type (-target) option that sets long
long to 64 bits. Compatible targets include:
i386, sparc,
m68k, powerpc,
tms320c3x, sharc21x61,
mpc5xx, x86_64, or
mcpu with long long set to 64
(-long-long-is-64bits at the command line).
If you use the option Check JSF
AV C++ rules (-jsf-coding-rules), select the compiler
generic. If you use another compiler, Polyspace cannot check the JSF® coding rules that require conforming to the ISO standard. For example,
AV Rule 8: “All code shall conform to ISO/IEC
14882:2002(E) standard C++.”
Polyspace does not support certain features of these compilers:
GNU® compilers (version 4.7 or later):
Nested functions.
For instance, the function bar is nested in
function
foo:
int foo (int a, int b)
{
int bar (int c) { return c * c; }
return bar (a) + bar (b);
}Binary operations with vector types where one operand uses the shorthand notation for uniform vectors.
For instance, in the addition operation, 2+a, 2 is
used as a shorthand notation for
{2,2,2,2}.
typedef int v4si __attribute__ ((vector_size (16)));
v4si res, a = {1,2,3,4};
res = 2 + a; /* means {2,2,2,2} + a */Forward declaration of function parameters.
For instance, the parameter len is forward
declared:
void func (int len; char data[len][len], int len)
{
/* … */
}Complex integer data types.
However, complex floating point data types are supported.
Initialization of structures with flexible array members using an initialization list.
For instance, the structure S has a flexible array
member tab. A variable of type S is
directly initialized with an initialization
list.
struct S {
int x;
int tab[]; /* flexible array member - not supported */
};
struct S s = { 0, 1, 2} ;s.tab[1].128-bit variables.
Polyspace cannot analyze this data type semantically. Bug Finder
allows use of 128-bit data types, but Code Prover shows a compilation
error if you use such a data type, for instance, the GCC extension
__float128.
GNU compilers version 7.x:
Type names _FloatN and _FloatNx are
not semantically supported. The analysis treats them as type
float, double, or long
double.
Constants of type _FloatN or
_FloatNx with suffixes fN,
FN, or fNx, such as
1.2f123 or 2.3F64x are not
supported.
Visual Studio compilers:
C++ Accelerated Massive Parallelism (AMP).
C++ AMP is a Visual Studio feature that accelerates your C++ code execution for
certain types of data-parallel hardware on specific targets. You
typically use the restrict keyword to enable this
feature.
void Buffer() restrict(amp)
{
...
}__assume statements.
You typically use __assume with a condition that is
false. The statement indicates that the optimizer must assume the
condition to be henceforth true. Code Prover cannot reconcile this
contradiction. You get the
error:
Asked for compulsory presence of absent entity : assert
Managed Extensions for C++ (required for the .NET Framework), or its successor, C++/CLI (C++ modified for Common Language Infrastructure)
__declspec keyword with attributes other than
noreturn, nothrow,
selectany or thread.
Parameter: -compiler |
Value: armcc | armclang | clang3.x | clang4.x |
clang5.x | codewarrior | cosmic | diab | generic | gnu3.4 | gnu4.6 | gnu4.7 | gnu4.8
| gnu4.9 | gnu5.x | gnu6.x | gnu7.x | gnu8.x | greenhills | iar | iar-ew | keil |
microchip | renesas | tasking | ti | visual10.0 | visual11.0 | visual12.0 |
visual14.0 | visual15.x | visual16.x | visual9.0 |
Default:
generic |
Example 1 (Bug Finder):
polyspace-bug-finder -lang c -sources
|
Example 2 (Bug Finder):
polyspace-bug-finder -lang cpp -sources
|
Example 1 (Code Prover):
polyspace-code-prover -lang c -sources
|
Example 2 (Code Prover):
polyspace-code-prover -lang cpp -sources
|
Example 1 (Bug Finder
Server):
polyspace-bug-finder-server -lang c
-sources |
Example 2 (Bug Finder Server):
polyspace-bug-finder-server -lang cpp -sources
|
Example 1 (Code Prover
Server):
polyspace-code-prover-server -lang c
-sources |
Example 2 (Code Prover
Server):
polyspace-code-prover-server -lang cpp
-sources |