fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
[DO NOT] CHECK [MEMORY] ALIGNMENT
Checks that objects in COMMON blocks, and objects in local arrays, derived types, structures and groups of equivalenced variables, start on aligned memory addresses.
Many systems access memory in 4 or 8 byte units, which are read or written at addresses which must be multiples of 4 or 8. The number of bytes read or written is the 'alignment granularity' of the system. If the granularity is 4 bytes, for example, then a 4-byte integer which does not start on a 4-byte boundary must be read by reading two 4-byte regions, and then by shifting and combining the data. The consequence is that memory is accessed much more efficiently if objects start on 'aligned' addresses, addresses which are multiples of the alignment granularity. Some systems are actually unable to access 4 or 8 byte objects which do not start on aligned addresses. This issue therefore affects portability as well as efficiency.
The declaration of objects in a Fortran COMMON block, the declaration of Fortran derived types and structures or the explicit equivalencing of objects, rigidly defines the absolute or relative addresses of the objects. fpt checks that the addresses are aligned appropriately according to the following rules:
Name Sub-prog/Struct Use/COMMON Address Type Size Bounds ---- --------------- ---------- ------- ---- ---- ------ XDOT INTEG,BODY,INTINI POSITN 66 REAL *4
Name Sub-prog/Struct Use/COMMON Address Type Size Bounds ---- --------------- ---------- ------- ---- ---- ------ XTEN FILCHK Local CHARACTER *50 (1:4) (Second element of array)
The alignment granularity of a system is specified to fpt by the command ALIGNMENT GRANULARITY. By default it is set to 4 bytes.
Checking of the alignment of character variables and array elements may be enabled or suppressed by the command ALIGNMENT CHECK TO CHECK CHARACTER VARIABLES.
Some systems automatically impose a 4 or 8 byte alignment on objects in COMMON blocks, irrespective of the COMMON block declarations. The Gould-SEL (Now Encore) Concept compiler, for example, automatically pads COMMON blocks to force alignment. fpt may be instructed to align objects automatically by the command ALIGN OBJECTS IN COMMON BLOCKS.
Where to Use this Command
|Operating system command line||Yes|
|Configuration file, config.fsp||Yes|
|Specification (fsp) files, *.fsp||Yes|
|Interactively, to FPT> prompt||Yes|
|Interactive command files||Yes|
|Embedded in the Fortran code||Yes|
The checks are not carried out by default (Note that defaults may be changed in the configuration file).
ALIGNMENT CHECK TO CHECK CHARACTER VARIABLES
ALIGN OBJECTS IN COMMON BLOCKS
Copyright ©1995 to 2023 Software Validation Ltd. All rights reserved.