-qrealsize

Category

Floating-point and integer control

Purpose

Sets the default size of REAL, DOUBLE PRECISION, COMPLEX, and DOUBLE COMPLEX values.

This option is intended for maintaining compatibility with code that is written for other systems. You may find it a useful alternative to the -qautodbl option in some situations.

Syntax

Read syntax diagramSkip visual syntax diagram
                     .-4-.   
>>- -q--realsize--=--+-8-+-------------------------------------><

@PROCESS:

@PROCESS REALSIZE(bytes)

Defaults

The default, -qrealsize=4, is suitable for programs that are written specifically for 32-bit computers.

Parameters

The allowed values for bytes are:
  • 4
  • 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 -qrealsize=8 for programs that are written for a CRAY computer.

-qautodbl is related to -qrealsize, although you cannot combine these options. When the -qautodbl option turns on automatic doubling, padding, or both, the -qrealsize option has no effect.

Setting -qrealsize to 8 overrides the setting of the -qdpc option.

In addition to type REAL, -qrealsize also works for type vector(real).

Results

The option affects the sizes1 of constants, variables, derived type components, and functions (which include intrinsic functions) for which no kind type parameter is specified. Objects that are declared with a kind type parameter or length, such as REAL(4) or COMPLEX*16, are not affected.

This option determines the sizes of affected objects as follows:
Data Object       REALSIZE(4) in Effect       REALSIZE(8) in Effect
-------------------------------------------------------------------
1.2               REAL(4)                      REAL(8)
1.2e0             REAL(4)                      REAL(8)
1.2d0             REAL(8)                      REAL(16)
1.2q0             REAL(16)                     REAL(16)

REAL              REAL(4)                      REAL(8)
DOUBLE PRECISION  REAL(8)                      REAL(16)
COMPLEX           COMPLEX(4)                   COMPLEX(8)
DOUBLE COMPLEX    COMPLEX(8)                   COMPLEX(16)
Similar rules apply to intrinsic functions:
  • If an intrinsic function has no type declaration, its argument and return types may be changed by the -qrealsize setting.
  • Any type declaration for an intrinsic function must agree with the default size of the return value.

Examples

This example shows how changing the -qrealsize setting transforms some typical entities:
@PROCESS REALSIZE(8)
         REAL R                  ! treated as a real(8)
         REAL(8) R8              ! treated as a real(8)
         VECTOR(REAL)            ! treated as a vector(real(8))
         VECTOR(REAL(4))         ! treated as a vector(real(4))
         DOUBLE PRECISION DP     ! treated as a real(16)
         DOUBLE COMPLEX DC       ! treated as a complex(16)
         COMPLEX(4) C            ! treated as a complex(4)
         PRINT *,DSIN(DP)        ! treated as qsin(real(16))
! Note: we cannot get dsin(r8) because dsin is being treated as qsin.
         END
Specifying -qrealsize=8 affects intrinsic functions, such as DABS, as follows:
INTRINSIC DABS        ! Argument and return type become REAL(16).
DOUBLE PRECISION DABS ! OK, because DOUBLE PRECISION = REAL(16)
                      ! with -qrealsize=8 in effect.
REAL(16) DABS         ! OK, the declaration agrees with the option setting.
REAL(8) DABS          ! The declaration does not agree with the option
                      ! setting and is ignored.

Related information

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