[Patch, Fortran, 4.5] Procedure Pointer Components
Janus Weil
janus@gcc.gnu.org
Sun Apr 19 16:23:00 GMT 2009
Hi all,
here goes another update to my PPC patch.
>> Some small points:
>> 1) The core of my contribution is trans-expr.c(gfc-get_proc_ptr_comp)
>> which provides the backend_decl for the component. This is called in
>> gfc_conv_function_expr and gfc_trans_call. The derived type symbol is
>> used in both places; the backend_decl is backed up and then restored
>> after the call. It might be neater to have an alternative
>> backend_decl for symbols. This works however.
>
> Well, it does not work in all cases. I attached an example where it
> fails, namely when the derived object is passed as an argument to the
> PPC, as in "call x%proc(x)". Of course one would rather do something
> like this with PASS, but using NOPASS is perfectly legal as well. In
> fact this testcase is inspired by an example from the "Fortran 2003
> Handbook" by Richard Maine et al.
> Paul, I don't know if you have time to look into this. If not I will
> try to fix it myself.
This finally works now (proc_ptr_comp_3.f90).
Moreover I fixed some more bugs, e.g. preveting infinite looping in
certain situations (thanks to Juergen Reuter for providing some very
helpful test cases!).
Of course there still remains some work to be done:
* there is still one testsuite failure (typebound_call_4.f03)
* assignment checking does not yet work for PPCs
* PASS is not implemented
Furthermore I plan to do some more work on gfc_conv_procedure call
(previously named gfc_conv_function_call), to unify the handling of
ordinary functions/subroutines and PPCs. Also my PPC implementation
still uses the f2k_derived namespace that Daniel introduced with his
patches for type-bound procedures. This is done mostly for
convenience, and should in principle not be necessary. Therefore I
would prefer to avoid it for PPCs, but this will require some more
effort.
Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc146339.diff
Type: text/x-patch
Size: 47323 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090419/31a87262/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_comp_1.f90
Type: text/x-fortran
Size: 515 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090419/31a87262/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_comp_2.f90
Type: text/x-fortran
Size: 1359 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090419/31a87262/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_comp_3.f90
Type: text/x-fortran
Size: 476 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090419/31a87262/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_comp_4.f90
Type: text/x-fortran
Size: 1041 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090419/31a87262/attachment-0004.bin>
More information about the Fortran
mailing list