Bug 40870 - [F03] include formal args in backend_decl of PPCs
[F03] include formal args in backend_decl of PPCs
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.5.0
: P3 normal
: ---
Assigned To: janus
: wrong-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-27 08:11 UTC by janus
Modified: 2009-08-18 14:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-08-03 20:17:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-07-27 08:11:49 UTC
Another PPC leftover item, cf. trans-types.c (gfc_get_ppc_type): When translating the Fortran frontend structures to a backend tree, the argument list of procedure pointer components is currently not being used.

This becomes visible in a test case like this:


implicit none
procedure(foo), pointer :: pp
type :: t
  procedure(foo), pointer, nopass :: ppc
end type
type(t)::o

pp => foo
o%ppc => foo
pp => o%ppc

contains

  integer function foo(a,b)
    integer, intent(in) :: a,b
    foo = a + b
  end function

end


Compiling with -fdump-tree-original shows the following code for the three pointer assignments:

  pp = foo;
  o.ppc = (integer(kind=4) (*<T3c6>) (void)) foo;
  pp = (integer(kind=4) (*<T3c8>) (integer(kind=4) &, integer(kind=4) &)) o.ppc;

The first one is ok, but the last two involve type casting, although they have exactly the same interface (simply because the arguments of the PPC are missing).
Comment 1 janus 2009-08-18 14:23:54 UTC
Subject: Bug 40870

Author: janus
Date: Tue Aug 18 14:23:35 2009
New Revision: 150875

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150875
Log:
2009-08-18  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40870
	* trans-types.c (gfc_get_ppc_type): Include formal args in backend_decl
	using the interface symbol. Character types are returned by reference.
	(gfc_get_derived_type): Prevent infinite recursion loop
	if a PPC has a derived-type formal arg.

2009-08-18  Janus Weil  <janus@gcc.gnu.org>
	    Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/40870
	* gfortran.dg/proc_ptr_comp_13.f90: Extended.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-types.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f90

Comment 2 janus 2009-08-18 14:25:00 UTC
Fixed with r150875. Closing.