Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Report a bug of ivf v11.

slsfortran
Beginner
309 Views

The f2003 feature "associate"

associate (x => sin(x))

x = x / 5d0

endassociate

will run well. However, the following will not (when it points an expression rather than a variable)

associate (x => sin(x) + 1d0)

x = x / 5d0

endassociate

0 Kudos
1 Reply
Kevin_D_Intel
Employee
309 Views

Neither form supplied here appears to be valid, although I could be wrong.

According to Fortran 95/2003 (by Michael Metcalf, John Ker Reid, John Reid, Malcolm Cohen), on pg. 276 it states:

"If the association is with an expression, the associate-name may be used only for its value."

Both forms supplied here result in a compilation error when trying to assign to X:

sample.f90(6): error #6421: This scalar or array name is invalid in this context.

x = x / 5d0

----^

If you modify the use to assign to a variable other than X, each form is accepted and executes as expected.

0 Kudos
Reply