Contenuto principale

-target

Specify size of data types and endianness by selecting a predefined target processor or creating a custom processor

Syntax

-target processorName

Description

-target processorName specifies the processor on which you deploy your code. You can specify a named processor with this option, or create a custom processor with -target mcpu, followed by options specifying processor details.

The following table lists the processor names supported with this option, along the processor details. If you select one of the specialized cross-compilers for the option -compiler, you can only specify a subset of the processors below. For more information on the supported processors and the corresponding processor details, see Compilation toolchain for static analysis (-compiler).

Targetcharshortintlonglong longfloatdoublelong doubleapointerDefault sign of charendianAlignment
i38681632326432649632signedLittle32
sparc816323264326412832signedBig64
m68kb81632326432649632signedBig64
powerpc816323264326412832unsignedBig64
necv85081632323232326432signedLittle32
hc08c81616323232323216dunsignedBig32
x86_648163264e64326412864signedLittle128
arm81632326432646432signedBig64
arm64816326464326412864signedBig128
riscv816323264326412832signedBig128
riscv64816326464326412864signedBig128
mcpu8816323232323216signedLittle32

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 Use option -long-is-32bits to support Microsoft® C/C++ Win64 target.

You can modify some properties of the named processors, or create a custom processor with -target mcpu and specify the processor details with another set of options:

OptionDescriptionAvailable WithExample
-little-endian

Little-endian architectures are Less Significant byte First (LSF). For example: i386.

Specifies that the less significant byte of a short integer (e.g. 0x00FF) is stored at the first byte (0xFF) and the most significant byte (0x00) at the second byte.

All targetspolyspace-bug-finder -target mcpu -little-endian
-big-endian

Big-endian architectures are Most Significant byte First (MSF). For example: SPARC, m68k.

Specifies that the most significant byte of a short integer (e.g. 0x00FF) is stored at the first byte (0x00) and the less significant byte (0xFF) at the second byte.

All targetspolyspace-bug-finder -target mcpu -big-endian
-default-sign-of-char [signed | unsigned]

Specify default sign of char.

signed: Specifies that char is signed, overriding target’s default.

unsigned: Specifies that char is unsigned, overriding target’s default.

All targetspolyspace-bug-finder -default-sign-of-char unsigned -target mcpu
-char-is-16bits

char defined as 16 bits and all objects have a minimum alignment of 16 bits

Incompatible with -short-is-8bits and -align 8

mcpupolyspace-bug-finder -target mcpu -char-is-16bits
-short-is-8bitsDefine short as 8 bits, regardless of signmcpupolyspace-bug-finder -target mcpu -short-is-8bits
-int-is-32bitsDefine int as 32 bits, regardless of sign. Alignment is also set to 32 bits.mcpu, hc08, hc12, mpc5xxpolyspace-bug-finder -target mcpu -int-is-32bits
-long-is-32bits

Define long as 32 bits, regardless of sign. Alignment is also set to 32 bits.

If your project sets int to 64 bits, you cannot use this option.

All targetspolyspace-bug-finder -target mcpu -long-is-32bits
-long-long-is-64bitsDefine long long as 64 bits, regardless of sign. Alignment is also set to 64 bits.mcpupolyspace-bug-finder -target mcpu -long-long-is-64bits
-double-is-64bitsDefine double and long double as 64 bits, regardless of sign.mcpu, sharc21x61, hc08, hc12, mpc5xxpolyspace-bug-finder -target mcpu -double-is-64bits
-pointer-is-24bitsDefine pointer as 24 bits, regardless of sign.c18polyspace-bug-finder -target c18 -pointer-is-24bits
-pointer-is-32bitsDefine pointer as 32 bits, regardless of sign.mcpupolyspace-bug-finder -target mcpu -pointer-is-32bits
-align [128|64|32|16|8]

Specifies the largest alignment of scalar objects, structures, classes, unions, or arrays to the 128, 64, 32, 16, or 8 bit boundaries.

For instance, if the alignment of basic types in an array or struct is always 8, the array or struct storage is strictly determined by the size of the individual data objects without member and end padding.

All targetspolyspace-bug-finder -target mcpu -align 16