[4.5, Patch, Fortran] PR 36704: Procedure pointer as function result
Janus Weil
jaydub66@googlemail.com
Thu Mar 12 13:42:00 GMT 2009
Hi Paul,
> I'll review the patch in full tonight.
thanks, that would be great. I made another small addition in
resolve.c (resolve_variable), fixing an error when a procptr returning
function is used as an actual argument (error: "Symbol ... has no
IMPLICIT type"), and extended proc_ptr_15.f90 slightly.
Note: In the PR two c.l.f. posts are linked which contain further test cases:
http://groups.google.com/group/comp.lang.fortran/msg/7bddd7097fb985a5
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/e0d04d755453a2a5
The first one ("program gptr") still doesn't compile. I think it is
invalid. However, I fixed all the problems this made in connection
with procptr return values.
The second c.l.f. reference contains several variants of a program
labeled "recursive_argument". I verified that versions 1 to 3 are
working with my patch and all give the same output. We could add
recursive_argument1.f90 as an additional test case.
As before: no regressions.
Cheers,
Janus
> On Wed, Mar 11, 2009 at 5:08 PM, Janus Weil <jaydub66@googlemail.com> wrote:
>> Hi all,
>>
>> here goes another update to my procptr result patch. After a private
>> review by Paul, I made a small modification to stick to the original
>> error messages in external_procedures_1.f90 (which is now compiled
>> with -std=f95). Moreover ...
>>
>>
>>> All the examples in proc_ptr_14.f90 are working now. Only the
>>> construct in proc_ptr_15.f90 still gives me headaches. Will try to
>>> sort that out soon.
>>
>> I finally managed to get the beast in proc_ptr_15.f90 working, and
>> added two more variants of it. The patch seems pretty complete to me
>> by now, and I fail to find any more exotic test cases. There have been
>> a few reviews already, but I am still missing approval.
>>
>> Regression-tested on x86_64-unknown-linux-gnu. Ok for 4.5?
>>
>> Cheers,
>> Janus
>>
>>
>>
>> 2009-03-11 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/36704
>> * decl.c (add_hidden_procptr_result): New function for handling
>> procedure pointer return values by adding a hidden result variable.
>> (variable_decl,match_procedure_decl,gfc_match_function_decl,
>> gfc_match_subroutine,gfc_match_end,attr_decl1): Handle procedure pointer
>> return values.
>> * parse.c (parse_interface): Add EXTERNAL attribute only after
>> FUNCTION/SUBROUTINE declaration is complete.
>> * primary.c (replace_hidden_procptr_result): New function for replacing
>> function symbol by hidden result variable.
>> (gfc_match_rvalue,match_variable): Replace symbol by hidden result
>> variable.
>> * resolve.c (resolve_contained_fntype,resolve_function,resolve_symbol):
>> Allow for procedure pointer function results.
>> (resolve_fl_procedure): Conflict detection moved here from
>> 'check_conflict'.
>> * symbol.c (gfc_check_function_type): Allow for procedure pointer
>> function results.
>> (check_conflict): Move some conflict detection to resolution stage.
>> * trans-types.c (gfc_sym_type,gfc_get_function_type): Handle hidden
>> result variables.
>>
>>
>> 2009-03-11 Janus Weil <janus@gcc.gnu.org>
>>
>> PR fortran/36704
>> * gfortran.dg/external_procedures_1.f90: Modified.
>> * gfortran.dg/proc_ptr_14.f90: New.
>> * gfortran.dg/proc_ptr_15.f90: New.
>>
>
>
>
> --
> The knack of flying is learning how to throw yourself at the ground and miss.
> --Hitchhikers Guide to the Galaxy
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr36704_2.diff
Type: text/x-patch
Size: 15933 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090312/618e7767/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_14.f90
Type: text/x-fortran
Size: 2579 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090312/618e7767/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_ptr_15.f90
Type: text/x-fortran
Size: 750 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20090312/618e7767/attachment-0002.bin>
More information about the Fortran
mailing list