Main Content

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

User interface (desktop products only): In your project configuration, the option is on the Target & Compiler node. To see the sizes of types, click the Edit button to the right of the Target processor type drop-down list.

User interface (Polyspace Platform, desktop products only): In your project configuration, the option is on the Build tab on the Target & Compiler node. This option is renamed to Processor in the Polyspace Platform user interface. See Processor.

For some compilers, in the user interface, you see only the processors allowed for that compiler. For these compilers, you also cannot see the data type sizes in the user interface. See the links in the table below for the data type sizes.

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
If the code compiles, the default sign of char is unsigned. For instance, on a GCC compiler, the code compiles with the -fsigned-char flag and fails to compile with the -funsigned-char flag.

Settings

Default: i386

This table shows the size of each fundamental data type that Polyspace considers. 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 [brackets] in the table.

Targetcharshortintlonglong longfloatdoublelong doubleaptrDefault sign of charendianAlignment
i38681632326432649632signedLittle32
sparc816323264326412832signedBig64
m68kb81632326432649632signedBig64
powerpc816323264326412832unsignedBig64
c-16781616323232646416signedLittle64
tms320c3x323232326432326432signedLittle32
sharc21x6132323232643232 [64]32 [64]32signedLittle32
necv85081632323232326432signedLittle32
hc08c81616 [32]32323232 [64]32 [64]16dunsignedBig32
hc1281616 [32]32323232 [64]32 [64]326signedBig32
mpc5xx8163232643232 [64]32 [64]32signedBig32
c188161632 [24]e3232323216 [24]signedLittle8
x86_648163264 [32]f64326412864signedLittle128
mcpu... (Advanced)g8 [16]8 [16]16 [32]3232 [64]3232 [64]32 [64]16 [32]signedLittle32
Targets for ARM® v5 compilerSee ARM v5 Compiler (-compiler armcc).
Targets for ARM v6 compilerSee ARM v6 Compiler (-compiler armclang).
Targets for NXP CodeWarrior® compilerSee NXP CodeWarrior Compiler (-compiler codewarrior).
Targets for Cosmic compilerSee Cosmic Compiler (-compiler cosmic).
Targets for Diab compilerSee Diab Compiler (-compiler diab).
Targets for Green Hills® compilerSee Green Hills Compiler (-compiler greenhills).
Targets for IAR Embedded Workbench compilerSee IAR Embedded Workbench Compiler (-compiler iar-ew).
Targets for MPLAB XC8 C compiler See MPLAB XC8 C Compiler (-compiler microchip)
Targets for Renesas® compilerSee Renesas Compiler (-compiler renesas).
Targets for TASKING compilerSee TASKING Compiler (-compiler tasking).
Targets for Texas Instruments® compiler See Texas Instruments Compiler (-compiler ti).

a For targets where the size of long double is greater than 64 bits, the size used for computations is not always the same as the size listed in this table. The exceptions are:

  • For targets i386, x86_64 and m68k, 80 bits are used for computations, following the practice in common compilers.

  • For the target tms320c3x, 40 bits are used for computation, following the TMS320C3x specifications.

  • If you use a Visual compiler, the size of long double used for computations is the same as size of double, following the specification of Visual C++® compilers.

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 c18 target supports the type short long as 24 bits in size.

f Use option -long-is-32bits to support Microsoft® C/C++ Win64 target.

g  mcpu is a reconfigurable Micro Controller/Processor Unit target. You can use this type to configure one or more generic targets. For more information, see Generic target options.

Tips

  • If your processor is not listed, use a similar processor that shares the same characteristics, or create an mcpu generic target processor. See Generic 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.