-qintsize

Category

Floating-point and integer control

Purpose

Sets the size of default INTEGER and LOGICAL data entities that have no length or kind specified.

This option is not intended as a general-purpose method for increasing the sizes of data entities. Its use is limited to maintaining compatibility with code that is written for other systems.

Syntax

Read syntax diagramSkip visual syntax diagram
                    .-4-.   
>>- -q--intsize--=--+-2-+--------------------------------------><
                    '-8-'   

@PROCESS:

@PROCESS INTSIZE(bytes)

Defaults

-qintsize=4

Parameters

bytes
Allowed sizes are 2, 4, or 8.

Usage

This option is intended to allow you to port programs unchanged from systems that have different default sizes for data. For example, you might need -qintsize=2 for programs that are written for a 16-bit microprocessor or -qintsize=8 for programs that are written for a CRAY computer. The default value of 4 for this option is suitable for code that is written specifically for many 32-bit computers. Note that specifying the -q64 compiler option does not affect the default setting for -qintsize.

You might need to add PARAMETER statements to give explicit lengths to constants that you pass as arguments.

The specified size1 applies to these data entities:

  • INTEGER and LOGICAL specification statements with no length or kind specified.
  • FUNCTION statements with no length or kind specified.
  • Intrinsic functions that accept or return default INTEGER or LOGICAL arguments or return values unless you specify a length or kind in an INTRINSIC statement. Any specified length or kind must agree with the default size of the return value.
  • Variables that are implicit integers or logicals.
  • Integer and logical literal constants with no kind specified. If the value is too large to be represented by the number of bytes that you specified, the compiler chooses a size that is large enough. The range for 2-byte integers is -(2**15) to 2**15-1, for 4-byte integers is -(2**31) to 2**31-1, and for 8-byte integers is -(2**63) to 2**63-1.
  • Typeless constants in integer or logical contexts.
  • In addition to types INTEGER and LOGICAL, -qintsize also works for vector(integer). Specifying -qintsize=2 is equivalent to specifying vector(integer*2). Similarly, specifying -qintsize=4 is equivalent to specifying vector(integer*4). Specifying -qintsize=8 is equivalent to vector(integer*8).

Examples

In the following example, note how variables, literal constants, intrinsics, arithmetic operators, and input/output operations all handle the changed default integer size.
@PROCESS INTSIZE(8)
      PROGRAM INTSIZETEST
      INTEGER I
      I = -9223372036854775807    ! I is big enough to hold this constant.
      J = ABS(I)                  ! So is implicit integer J.
      IF (I .NE. J) THEN
        PRINT *, I, '.NE.', J
      END IF
      END
The following example only works with the default size for integers:
      CALL SUB(17)
      END

      SUBROUTINE SUB(I)
      INTEGER(4) I                ! But INTSIZE may change "17"
                                  ! to INTEGER(2) or INTEGER(8).
      …
      END
If you change the default value, you must either declare the variable I as INTEGER instead of INTEGER(4) or give a length to the actual argument, as follows:
@PROCESS INTSIZE(8)
      INTEGER(4) X
      PARAMETER(X=17)
      CALL SUB(X)      ! Use a parameter with the right length, or
      CALL SUB(17_4)   ! use a constant with the right kind.
      END

Related information

1 In Fortran 90/95 terminology, these values are referred to as kind type parameters.