This is the mail archive of the mailing list for the GCC 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: [4.5, Patch, Fortran] PR 36704: Procedure pointer as function result

Janus Weil wrote:
> If not: Ok for trunk?
> (Regtested on x86_64-unknown-linux-gnu)
Please don't forget to CC gcc-patches@.

I think the patch can go in, if one fixes the following issue afterwards.

! compile with -std=f95
function f()
  intrinsic sin
  external f
  pointer f
  real f
! ICE without the following line
! strange error with that line
!  f => sin
end function f

Some tiny nit found while reading the patch:

  function aux()
    external aux
    pointer aux
  end function

Can you add a "aux=>something" line there? I know the warning is not
triggered as the error message for "foo" comes earlier but ...

module mo
  function j()
    procedure(),pointer :: j
    j => iabs

Pedantically, I would add an "intrinsic iabs".


> 2009-04-08  Janus Weil  <>
> 	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-08  Janus Weil  <>
> 	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.

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