Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

VALUE

Statement and Attribute: Specifies a type of argument association for a dummy argument.

The VALUE attribute can be specified in a type declaration statement or a VALUE statement, and takes one of the following forms:

Type Declaration Statement:

type, [att-ls, ] VALUE [, att-ls] :: arg [, arg] ...

Statement:

VALUE [::] arg [, arg]...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

arg

Is the name of a dummy argument.

Description

The VALUE attribute can be used in INTERFACE body or in a procedure. It can only be specified for dummy arguments. It cannot be specified for a dummy procedure.

An entity with the VALUE attribute must be a dummy data object that is not an assumed-size array or a coarray, and does not have a coarray ultimate component.

When this attribute is specified for a present dummy argument, the dummy argument becomes associated with a temporary, definable data object whose initial value is that of the corresponding actual argument. The actual mechanism by which this happens is determined by the compiler. If the procedure also has the BIND(C) attribute, the dummy argument is interoperable with the corresponding formal parameter of the C language prototype, causing the argument to be passed or received by value if C would do so.

When the VALUE attribute is used in a type declaration statement, any length type parameter values must be omitted or they must be specified by initialization expressions.

If the VALUE attribute is specified, you cannot specify a PARAMETER, EXTERNAL, POINTER, ALLOCATABLE, VOLATILE, or INTENT (INOUT or OUT) attribute in the same scoping unit.

You can use option assume nostd_value to tell the compiler to use non-standard semantics for VALUE so that the value of the actual argument is passed to the called procedure, not the address of the actual argument nor the address of a copy of the actual argument.

Example

The following example shows how the VALUE attribute can be applied in a type declaration statement.

j = 3
call sub (j)
write (*,*) j ! Writes 3
contains
subroutine sub (i)
integer, value :: I
i = 4
write (*,*) i ! Writes 4
end subroutine sub
end