*ping* [Patch, Fortran] PR35203 - Fix VALUE + OPTIONAL handling for pass-by-value arguments
Tobias Burnus
burnus@net-b.de
Thu Mar 28 21:33:00 GMT 2013
*ping* / http://gcc.gnu.org/ml/fortran/2013-03/msg00102.html
On March 21, 2013 19:02, Tobias Burnus wrote:
> Dear all,
>
> using VALUE, gfortran passes the arguments by value.* That works well,
> except if VALUE is combined with OPTIONAL. Currently, "call foo(0)"
> and "call foo()" are indistinguishable.
>
> With this patch, a hidden argument is added which includes the present
> information. I think that's the least intrusive version which also has
> the performance advantage of continuing to use pass-by-value semantics.
>
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?
>
> Tobias
>
> PS: At some point, we need to handle VALUE with arrays, derived types
> and class. For those, one should pass by reference, doing a copy in.
> In that case, using the NULL-pointer check for present() should work.
> (PR 49802)
>
> * Except for character. (Note: value+optional for characters currently
> fails with an ICE, also tracked at PR 49802.)
More information about the Fortran
mailing list