Bug 39735 - procedure pointer assignments: return value is not checked
procedure pointer assignments: return value is not checked
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.5.0
: P3 normal
: ---
Assigned To: janus
: accepts-invalid
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-11 12:13 UTC by janus
Modified: 2009-04-22 09:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-04-22 09:23:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-04-11 12:13:36 UTC
Currently the validity checks for procedure pointer assignments are limited to formal/actual arguments and function/subroutine (see proc_ptr_11.f90 and PR 38290), but a check for the return value is missing.

Example:

procedure(real), pointer :: p1
procedure(integer), pointer :: p2

p1 => iabs
p1 => p2
Comment 1 janus 2009-04-22 09:06:24 UTC
Subject: Bug 39735

Author: janus
Date: Wed Apr 22 09:05:58 2009
New Revision: 146554

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146554
Log:
2009-04-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39735
	* decl.c (add_hidden_procptr_result): Bugfix for procptr results.
	(match_procedure_decl): Set if_source.
	* expr.c (gfc_check_pointer_assign): Bugfix: Return after error.
	And: Check interface also for IFSRC_UNKNOWN (return type may be known).
	* gfortran.h (typedef enum ifsrc): Remove IFSRC_USAGE,
	add documentation. Rename copy_formal_args and copy_formal_args_intr.
	* interface.c (gfc_compare_interfaces): Check for return types,
	handle IFSRC_UNKNOWN.
	(compare_intr_interfaces,compare_actual_formal_intr): Obsolete, removed.
	(gfc_procedure_use): Modified handling of intrinsics.
	* intrinsic.c (add_functions): Bugfix for "dim".
	* resolve.c (resolve_intrinsic): New function to resolve intrinsics,
	which copies the interface from isym to sym.
	(resolve_procedure_expression,resolve_function): Use new function
	'resolve_intrinsic'.
	(resolve_symbol): Add function attribute for externals with return type
	and use new function 'resolve_intrinsic'.
	* symbol.c (ifsrc_types): Remove string for IFSRC_USAGE.
	(copy_formal_args): Renamed to gfc_copy_formal_args.
	(copy_formal_args_intr): Renamed to gfc_copy_formal_args_intr.
	* trans-const.c (gfc_conv_const_charlen): Handle cl==NULL.


2009-04-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39735
	* gfortran.dg/assumed_charlen_function_5.f90: Modified.
	* gfortran.dg/external_initializer.f90: Modified.
	* gfortran.dg/interface_26.f90: Modified.
	* gfortran.dg/intrinsic_subroutine.f90: Modified.
	* gfortran.dg/proc_ptr_3.f90: Modified.
	* gfortran.dg/proc_ptr_15.f90: New.
	* gfortran.dg/proc_ptr_result_1.f90: Modified.


Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_15.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/trans-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f90
    trunk/gcc/testsuite/gfortran.dg/external_initializer.f90
    trunk/gcc/testsuite/gfortran.dg/interface_26.f90
    trunk/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_3.f90
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_result_1.f90

Comment 2 janus 2009-04-22 09:24:00 UTC
Fixed with r146554. Closing.