diff options
author | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-12-14 12:04:49 +0000 |
---|---|---|
committer | janus <janus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-12-14 12:04:49 +0000 |
commit | 0252ef5c6729e472adcd95b49d4a33521d908ee3 (patch) | |
tree | cb5e16af307f095cd94a87bf193d891742cca6eb /gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90 | |
parent | 4b6861868d3115333607c8277b04a566a77c5d95 (diff) | |
download | gcc-0252ef5c6729e472adcd95b49d4a33521d908ee3.tar.gz |
2014-12-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/63674
* resolve.c (pure_function): Treat procedure-pointer components.
(check_pure_function): New function.
(resolve_function): Use it.
(pure_subroutine): Return a bool to indicate success and modify
arguments.
(resolve_generic_s0,resolve_specific_s0,resolve_unknown_s): Use return
value of 'pure_subroutine'.
(resolve_ppc_call): Call 'pure_subroutine'.
(resolve_expr_ppc): Call 'check_pure_function'.
2014-12-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/63674
* gfortran.dg/proc_ptr_comp_39.f90: New.
* gfortran.dg/pure_dummy_length_1.f90: Modified error message.
* gfortran.dg/stfunc_6.f90: Ditto.
* gfortran.dg/typebound_operator_4.f90: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218717 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90 new file mode 100644 index 00000000000..cc4096a4ecc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_39.f90 @@ -0,0 +1,32 @@ +! { dg-do compile } +! +! PR 63674: [F03] procedure pointer and non/pure procedure +! +! Contributed by Valery Weber <valeryweber@hotmail.com> + +program prog + interface + integer function nf() + end function + pure integer function pf() + end function + subroutine ns() + end subroutine + pure subroutine ps() + end subroutine + end interface + type :: t + procedure(nf), nopass, pointer :: nf => NULL() ! non-pure function + procedure(pf), nopass, pointer :: pf => NULL() ! pure function + procedure(ns), nopass, pointer :: ns => NULL() ! non-pure subroutine + procedure(ps), nopass, pointer :: ps => NULL() ! pure subroutine + end type +contains + pure integer function eval(a) + type(t), intent(in) :: a + eval = a%pf() + eval = a%nf() ! { dg-error "Reference to non-PURE function" } + call a%ps() + call a%ns() ! { dg-error "is not PURE" } + end function +end |