HP 3000 Manuals

ALIGNMENT Directive [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

ALIGNMENT Directive 

The ALIGNMENT directive aligns COMPLEX*8 data on 4 or 8 byte boundaries
as specified by the user.

Syntax 

$ALIGNMENT COMPLEX_8 [4]
                     [8]

4             Aligns all COMPLEX*8 data on 32 bit boundaries.

8             Aligns all COMPLEX*8 data on 64 bit boundaries.

Default               64 bit boundaries.

Location              This directive may appear before any program or
                      subprogram unit, but may not appear among
                      executable statements within a program or
                      subprogram unit.

Toggling/ Duration    When multiple $ALIGNMENT directives are found in a
                      program, the last occurrence of the directive will
                      be in effect until reset by a later occurrence of
                      the directive.

Example 

         PROGRAM DemonstrateAlign
         CALL initialize
         CALL modify8
         CALL test8
         CALL initialize
         CALL modify4
         CALL test4
         END

         SUBROUTINE initialize     ! initialized common block to 0.
             COMMON /block/ intarray
             INTEGER*4 intarray(4)
             DO 10 i=1,4
              intarray(i) = 0
      10     CONTINUE
         END

     $ALIGNMENT COMPLEX_8 8
         SUBROUTINE modify8
         COMMON / block/ i4, c8
         INTEGER*4 i4
         COMPLEX*8 c8
         I4 = '7FFFFFFF'x
         c8 = '7FFFFFFF7FFFFFFF'x
         END

         SUBROUTINE test8
         COMMON /block/ intarray
             INTEGER*4 intarray(4)
             IF (intarray(2) .EQ. 0) THEN
               PRINT*, "The data was 8 byte aligned this time."
             ELSE
               PRINT*, "The data was 4 byte aligned this time."
             ENDIF
         END

     $ALIGNMENT COMPLEX_8 4
         SUBROUTINE modify4
             COMMON /block/ i4, c8
             INTEGER*4 i4
             COMPLEX*8 c8
             i4 = '7FFFFFFF'x
             c8 = '7FFFFFFF7FFFFFFF'x
         END

         SUBROUTINE test4
         COMMON /block/ intarray
             INTEGER*4 intarray(4)
             IF (intarray(2) .EQ. 0 THEN
               PRINT*, "The data was 8 byte aligned this time."
             ELSE IF (intarray(4) .EQ. 0) THEN
               PRINT*, "The data was 4 byte aligned this time."
             ENDIF
         END

Output: 

The data was 8 byte aligned this time.  The data was 4 byte aligned this
time.



MPE/iX 5.0 Documentation