Intel® Fortran Compiler 16.0 User and Reference Guide
Built-in Function: Changes the form of an actual argument. Passes the argument as an immediate value.
%VAL (a)
a |
(Input) An expression, record name, procedure name, array, character array section, or array element. |
The argument is passed as follows:
On IA-32 architecture, as a 32-bit immediate value. If the argument is integer (or logical) and shorter than 32 bits, it is sign-extended to a 32-bit value. For complex data types, %VAL passes two 32-bit arguments.
On Intel® 64 architecture, as a 64-bit immediate value. If the argument is integer (or logical) and shorter than 64 bits, it is sign-extended to a 64-bit value. For complex data types, %VAL passes two 64-bit arguments.
You must specify %VAL in the actual argument list of a CALL statement or function reference. You cannot use it in any other context.
The following tables list the Intel® Fortran defaults for argument passing, and the allowed uses of %VAL:
Actual Argument Data Type |
Default |
%VAL |
---|---|---|
Logical |
REF |
Yes1 |
Integer |
REF |
Yes1 |
REAL(4) |
REF |
Yes |
REAL(8) |
REF |
No |
REAL(16) |
REF |
No |
COMPLEX(4) |
REF |
Yes |
COMPLEX(8) |
REF |
Yes |
COMPLEX(16) |
REF |
No |
Character |
See table note 2 |
No |
Hollerith |
REF |
No |
Aggregate3 |
REF |
No |
Derived |
REF |
No |
Actual Argument Data Type |
Default |
%VAL |
---|---|---|
Numeric |
REF |
No |
Character |
See table note 2 |
No |
Aggregate3 |
REF |
No |
Derived |
REF |
No |
Actual Argument Data Type |
Default |
%VAL |
---|---|---|
Numeric |
REF |
No |
Character |
See table note 2 |
No |
1 If a logical or integer value occupies less than 64 bits of storage on Intel® 64 architecture, or 32 bits of storage on IA-32 architecture, it is converted to the correct size by sign extension. Use the ZEXT intrinsic function if zero extension is desired.
2 A character argument is passed by address and hidden length.
3 In Intel® Fortran record structures
The %VAL and %REF functions override related !DIR$ ATTRIBUTE settings.
CALL SUB(2, %VAL(2))
Constant 2 is passed by reference. The second constant 2 is passed by immediate value.