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

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 a psprj 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
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 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.

Targetcharshortintlonglong longfloatdoublelong doubleapointerDefault 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
arm81632326432646432signedBig64
arm64816326464326412864signedBig128
riscv816323264326412832signedBig128
riscv64816326464326412864signedBig128
mcpu... (Advanced)g8 [16]8 [16]16 [32]3232 [64]3232 [64]32 [64]16 [32]signedLittle32

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.

In addition to the natively supported compilers, Polyspace supported various specialty compilers. You can select supported target processors for these specialty compilers:

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.