Target processor type (-target
)
Specify size of data types and endianness by selecting a predefined target processor
Description
Specify the processor on which you deploy your code.
The target processor determines the sizes of fundamental data types and the endianness of the target machine. You can analyze code intended for an unlisted processor type by using one of the other processor types, if they share common data properties.
Set Option
Set the option using one of these methods:
Polyspace® user interface (desktop products only) — In your project configuration, select the Target & Compiler node and then select a value for this option.
To see the sizes of types, click the Edit button to the right of the Target processor type drop-down list. For some compilers, you see only the processors allowed for that compiler. For these compilers, data type sizes are not visible in the user interface. For the data type sizes, see Settings.
Polyspace Platform user interface (desktop products only) — This option is named Processor in the Polyspace Platform user interface and shows a different list of supported targets. See
Processor
. Targets supported by the option Target processor type (listed in Settings) cannot be directly selected in the Polyspace Platform user interface. If you open apsprj
Polyspace project file in the Polyspace Platform user interface, the target used in the project is converted into a custom target processor and listed in the Processor option.Command line and options file — Use the option
-target
. See Command-Line Information.
Why Use This Option
You specify a target processor so that some of the Polyspace run-time checks are tailored to the data type sizes and other properties of that processor.
For instance, a variable can overflow for smaller values on a 32-bit processor such as i386 compared to a 64-bit processor such as x86_64. If you select x86_64 for your Polyspace analysis, but deploy your code to the i386 processor, your Polyspace results are not always applicable.
Once you select a target processor, you can specify if the default sign of char is signed or unsigned. To determine which signedness to specify, compile this code using the compiler settings that you typically use:
#include <limits.h> int array[(char)UCHAR_MAX]; /* If char is signed, the array size is -1
-fsigned-char
flag and fails
to compile with the -funsigned-char
flag.Settings
Default: i386
This table shows the assumed size of each fundamental data type for various target processors
when used in conjunction with the generic
, GCC, Clang, and
Visual Studio® compilers. For some targets, you can modify the default size by clicking
the Edit button to the right of the Target processor
type drop-down list. The optional values for those targets are shown in
using square brackets in the table.
Target | char | short | int | long | long long | float | double | long doublea | pointer | Default sign of char | endian | Alignment |
---|---|---|---|---|---|---|---|---|---|---|---|---|
i386 | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 96 | 32 | signed | Little | 32 |
sparc | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 128 | 32 | signed | Big | 64 |
m68k b | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 96 | 32 | signed | Big | 64 |
powerpc | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 128 | 32 | unsigned | Big | 64 |
c-167 | 8 | 16 | 16 | 32 | 32 | 32 | 64 | 64 | 16 | signed | Little | 64 |
tms320c3x | 32 | 32 | 32 | 32 | 64 | 32 | 32 | 64 | 32 | signed | Little | 32 |
sharc21x61 | 32 | 32 | 32 | 32 | 64 | 32 | 32 [64] | 32 [64] | 32 | signed | Little | 32 |
necv850 | 8 | 16 | 32 | 32 | 32 | 32 | 32 | 64 | 32 | signed | Little | 32 |
hc08 c | 8 | 16 | 16 [32] | 32 | 32 | 32 | 32 [64] | 32 [64] | 16d | unsigned | Big | 32 |
hc12 | 8 | 16 | 16 [32] | 32 | 32 | 32 | 32 [64] | 32 [64] | 326 | signed | Big | 32 |
mpc5xx | 8 | 16 | 32 | 32 | 64 | 32 | 32 [64] | 32 [64] | 32 | signed | Big | 32 |
c18 | 8 | 16 | 16 | 32 [24]e | 32 | 32 | 32 | 32 | 16 [24] | signed | Little | 8 |
x86_64 | 8 | 16 | 32 | 64 [32]f | 64 | 32 | 64 | 128 | 64 | signed | Little | 128 |
arm | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 64 | 32 | signed | Big | 64 |
arm64 | 8 | 16 | 32 | 64 | 64 | 32 | 64 | 128 | 64 | signed | Big | 128 |
riscv | 8 | 16 | 32 | 32 | 64 | 32 | 64 | 128 | 32 | signed | Big | 128 |
riscv64 | 8 | 16 | 32 | 64 | 64 | 32 | 64 | 128 | 64 | signed | Big | 128 |
mcpu... (Advanced) g | 8 [16] | 8 [16] | 16 [32] | 32 | 32 [64] | 32 | 32 [64] | 32 [64] | 16 [32] | signed | Little | 32 |
a For targets where the size of
b The M68k family (68000, 68020, and so on) includes the “ColdFire” processor c Non-ANSI C specified keywords and compiler implementation-dependent pragmas and interrupt facilities are not taken into account by this support d All kinds of pointers (near or far pointer) have 2 bytes (hc08) or 4 bytes (hc12) of width physically. e The f Use option g
|
In addition to the natively supported compilers, Polyspace supported various specialty compilers. You can select supported target processors for these specialty compilers:
Targets for ARM® v5 compiler — See
ARM v5 Compiler (-compiler armcc)
.Targets for ARM v6 compiler — See
ARM v6 Compiler (-compiler armclang)
.Targets for NXP CodeWarrior® compiler — See
NXP CodeWarrior Compiler (-compiler codewarrior)
.Targets for Cosmic compiler — See
Cosmic Compiler (-compiler cosmic)
.Targets for Diab compiler — See
Diab Compiler (-compiler diab)
.Targets for Green Hills® compiler — See
Green Hills Compiler (-compiler greenhills)
.Targets for IAR Embedded Workbench compiler — See
IAR Embedded Workbench Compiler (-compiler iar-ew)
.Targets for MPLAB XC8 C compiler — See
MPLAB XC8 C Compiler (-compiler microchip)
Targets for Renesas® compiler — See
Renesas Compiler (-compiler renesas)
.Targets for TASKING compiler — See
TASKING Compiler (-compiler tasking)
.Targets for Texas Instruments® compiler — See
Texas Instruments Compiler (-compiler ti)
.
Tips
If your processor is not listed, use a similar processor that shares the same characteristics, or create an
mcpu
generic target processor. SeeGeneric target options
.You can also create a custom target by explicitly stating sizes of fundamental types and so on with the option
-custom-target
.If your configuration uses both
-custom-target
and-target
to specify targets, the analysis uses the target that you specify with-custom-target
.
Command-Line Information
Parameter: -target |
Value:
i386 | sparc | m68k | powerpc | c-167 | tms320c3x | sharc21x61 | necv850 |
hc08 | hc12 | mpc5xx | c18 | x86_64 | mcpu |
Default: i386 |
Example (Bug Finder): polyspace-bug-finder
-target m68k |
Example (Code Prover):
polyspace-code-prover -target m68k |
Example (Bug Finder Server): polyspace-bug-finder-server -target m68k |
Example (Code Prover
Server):
polyspace-code-prover-server -target
m68k |
You can override the default values for some targets by using specific command-line options.
See the section Command-Line Options in Generic
target options
.
See Also
Polyspace Analysis Options
Polyspace Results
Lower Estimate of Size of Local Variables
(Polyspace Code Prover) |Higher Estimate of Size of Local Variables
(Polyspace Code Prover)