Commit 7e9c61e8 by Janus Weil

re PR fortran/40450 ([F03] procedure pointer as actual argument)

2009-06-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40450
	* trans-expr.c (gfc_conv_procedure_call): Only add an extra addr_expr
	to a procedure pointer actual argument, if it is not itself a
	dummy arg.

2009-06-19  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40450
	* gfortran.dg/proc_ptr_20.f90: New.

From-SVN: r148690
parent dd26af70
2009-06-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/40450
* trans-expr.c (gfc_conv_procedure_call): Only add an extra addr_expr
to a procedure pointer actual argument, if it is not itself a
dummy arg.
2009-06-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/40451
......
......@@ -2646,7 +2646,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
if (fsym && e->expr_type != EXPR_NULL
&& ((fsym->attr.pointer
&& fsym->attr.flavor != FL_PROCEDURE)
|| fsym->attr.proc_pointer))
|| (fsym->attr.proc_pointer
&& !(e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.dummy))))
{
/* Scalar pointer dummy args require an extra level of
indirection. The null pointer already contains
......
2009-06-19 Janus Weil <janus@gcc.gnu.org>
PR fortran/40450
* gfortran.dg/proc_ptr_20.f90: New.
2009-06-18 H.J. Lu <hongjiu.lu@intel.com>
PR target/40470
......
! { dg-do run }
!
! PR 40450: [F03] procedure pointer as actual argument
!
! Contributed by John McFarland <john.mcfarland@swri.org>
MODULE m
ABSTRACT INTERFACE
SUBROUTINE sub()
END SUBROUTINE sub
END INTERFACE
CONTAINS
SUBROUTINE passf(f2)
PROCEDURE(sub), POINTER:: f2
CALL callf(f2)
END SUBROUTINE passf
SUBROUTINE callf(f3)
PROCEDURE(sub), POINTER :: f3
PRINT*, 'calling f'
CALL f3()
END SUBROUTINE callf
END MODULE m
PROGRAM prog
USE m
PROCEDURE(sub), POINTER :: f1
f1 => s
CALL passf(f1)
CONTAINS
SUBROUTINE s
PRINT*, 'sub'
END SUBROUTINE s
END PROGRAM prog
! { dg-final { cleanup-modules "m" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment