[Bug fortran/49509] cannot promote types for arguments passed by value

stevenj at alum dot mit.edu gcc-bugzilla@gcc.gnu.org
Thu Jun 23 02:55:00 GMT 2011


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

--- Comment #2 from stevenj at alum dot mit.edu 2011-06-23 02:54:50 UTC ---
You're missing the point.  Traditionally in Fortran, all arguments were passed
*by reference*, in which case it is clearly a requirement that actual parameter
match the formal parameter's type exactly, because the formal parameter refers
to the *same memory* as the actual parameter.

However, in this case we are passing by value.  This should act just like an
assignment of the formal parameter to the actual parameter (as opposed to
having them be the *same* object as in passing by reference).  Hence, just like
an assignment statement the compiler should be able to assign a narrower
integer type to a wider one.

Hence, the familiar old requirements of the Fortran standard are irrelevant.
The question is, what does the Fortran 2003 standard require for passing by
value, which is I believe is NEW IN FORTRAN 2003, and is SPECIFIC TO BIND(C)
functions.



More information about the Gcc-bugs mailing list