Intel® Fortran Compiler 18.0 Developer Guide and Reference

ATTRIBUTES CODE_ALIGN

The ATTRIBUTES directive option CODE_ALIGN specifies the byte alignment for a procedure.

!DIR$ ATTRIBUTES CODE_ALIGN: n:: procedure-name

n

Is the number of bytes for the minimum alignment boundary. It must be a power of 2 between 1 and 4096, such as 1, 2, 4, 8, 16, 32, 64, 128, and so on.

If you specify 1 for n, no alignment is performed. If you do not specify n, the default alignment is 16 bytes.

procedure-name

Is the name of a procedure.

This directive can be affected by compiler option -falign-loops (Linux* and macOS*) or /Qalign-loops (Windows*), the CODE_ALIGN directive, and the CODE_ALIGN attribute.

If code is compiled with the -falign-loops=m (Linux and macOS*) or /Qalign-loops:m (Windows) option and a procedure has the CODE_ALIGN:k attribute, the procedure is aligned on a MAX (m, k) byte boundary. If a procedure has the CODE_ALIGN:k attribute and a CODE_ALIGN:n directive precedes a loop, then both the procedure and the loop are aligned on a MAX (k, n) byte boundary.

Example

Consider the following code fragment in file test_align.f90:

FUNCTION F ()
!DIR$ ATTRIBUTES CODE_ALIGN:32 :: F
…
!DIR$ CODE_ALIGN:16
DO J = 1, N
…
END DO
…
END FUNCTION F

Compiling test_align.f90 with option -falign-loops=64 (Linux and macOS*) or /Qalign-loops:64 (Windows) aligns the function F and the DO J loop on 64-byte boundaries.

See Also