diff options
author | Janus Weil <janus@gcc.gnu.org> | 2009-04-09 11:39:09 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2009-04-09 11:39:09 +0200 |
commit | 3070bab4c9421f35fd4149a238768befd2717ddb (patch) | |
tree | 281a4a95643d1f27ef18644d79406042326b0862 /gcc/fortran/parse.c | |
parent | b61ee1aa7b06fe0c5d970a943aa8451c1e04c97d (diff) | |
download | gcc-3070bab4c9421f35fd4149a238768befd2717ddb.zip gcc-3070bab4c9421f35fd4149a238768befd2717ddb.tar.gz gcc-3070bab4c9421f35fd4149a238768befd2717ddb.tar.bz2 |
re PR fortran/36704 (Procedure pointer as function result)
2009-04-09 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_variable,
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-04-09 Janus Weil <janus@gcc.gnu.org>
PR fortran/36704
* gfortran.dg/external_procedures_1.f90: Modified.
* gfortran.dg/proc_ptr_result_1.f90: New.
* gfortran.dg/proc_ptr_result_2.f90: New.
* gfortran.dg/proc_ptr_result_3.f90: New.
From-SVN: r145815
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r-- | gcc/fortran/parse.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 1925198..81e4591 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -2113,14 +2113,6 @@ loop: gfc_free_namespace (gfc_current_ns); goto loop; } - if (current_interface.type != INTERFACE_ABSTRACT && - !gfc_new_block->attr.dummy && - gfc_add_external (&gfc_new_block->attr, &gfc_current_locus) == FAILURE) - { - reject_statement (); - gfc_free_namespace (gfc_current_ns); - goto loop; - } break; case ST_PROCEDURE: @@ -2213,6 +2205,10 @@ decl: goto decl; } + /* Add EXTERNAL attribute to function or subroutine. */ + if (current_interface.type != INTERFACE_ABSTRACT && !prog_unit->attr.dummy) + gfc_add_external (&prog_unit->attr, &gfc_current_locus); + current_interface = save; gfc_add_interface (prog_unit); pop_state (); |