Print

Print


Neil Carlson writes:

> I'm also curious what the latest versions of other compilers do; I only
> have access to two, one is correct and the other isn't (as I understand
> it at this time).

Both Compaq Visual Fortran 6.6A and Intel Fortran for Windows 6.0 complain
that the assignment is not allowed.

My reading of F95 suggests that this is the correct behavior.  On page 53,
starting with line 13, it says:

Constraint: A dummy argument with the INTENT(IN) attribute, or a subobject
of such a dummy argument, shall not appear as

(1) The 'variable' of an 'assignment-stmt'
...

In the case in question, the dummy argument is 'a', the subobject is a%x,
and a%x appears as the 'variable' in an assignment statement, therefore this
is disallowed since 'a' is INTENT(IN).

I don't have the previous discussion available to see what has been said
before, but this seems pretty clear to me.

By the way, if one had a pointer assignment instead, then it would fall
afoul of the second item in the constraint:

(2) The 'pointer-object' of a 'pointer-assignment-stmt'

I would be interested in seeing the arguments in favor of the notion that
INTENT(IN) allows redefinition of either the pointer or its target.

Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH