This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: *ping* [Patch, Fortran] PR35203 - Fix VALUE + OPTIONAL handling for pass-by-value arguments


*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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]