http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49509

--- Comment #4 from stevenj at alum dot mit.edu 2011-06-23 03:23:06 UTC ---
Section 12.4.1.2 of Fortran 2003 standard:
"If the dummy argument has the VALUE attribute it becomes associated with a
definable anonymous data object whose initial value is that of the actual
argument."

Furthermore, NOTE 12.22 says:
"If the VALUE attribute is specified, the effect is as if the actual argument
is assigned to a temporary, and the temporary is then argument associated with
the dummy argument.  The actual mechanism by which this happens is determined
by the processor."

Thus, if you have a subroutine foo(x) with T, VALUE :: X, then the standard
requires that 

      call foo(y)

have the same "effect as if" you did

     T :: temp
     temp = y
     call foo(temp)

with pass by reference.  But in that case, it would be valid to assign y to a
wider type T.

This implicitly contravenes the wording earlier in the section that the dummy
and actual argument be "type compatible (5.1.1.2)".   It is unfortunate that it
is not explicit on this point, however -- one could argue that there is a bug
in the standard here.

Reply via email to