From 8a0262792d3ac272c62929cb413ad796607487bd Mon Sep 17 00:00:00 2001 From: kargl Date: Sun, 23 Aug 2009 04:58:31 +0000 Subject: [PATCH] 2009-08-22 Steven G. Kargl * gfortran.dg/proc_ptr_24.f90: New test. 2009-08-22 Steven G. Kargl * fortran/decl.c: Disallow procedure pointers with -std=f95. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151026 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 4 ++++ gcc/fortran/decl.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/proc_ptr_24.f90 | 21 +++++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_24.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4869fe82fb9..d6d6a9119f7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2009-08-22 Steven G. Kargl + + * fortran/decl.c: Disallow procedure pointers with -std=f95. + 2009-08-22 Steven K. kargl * fortran/decl.c (match_char_spec): Rename to gfc_match_char_spec, diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 1533af54eaa..40622e2e93f 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -4449,6 +4449,10 @@ match_ppc_decl (void) return MATCH_ERROR; } + if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Procedure pointer " + "component at %C") == FAILURE) + return MATCH_ERROR; + /* Match PPC names. */ ts = current_ts; for(num=1;;num++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c8997d15ce..db8a1959817 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2009-08-22 Steven G. Kargl + + * gfortran.dg/proc_ptr_24.f90: New test. + 2009-08-22 Steven K. kargl * gfortran.dg/allocate_alloc_opt_4.f90: New test. diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_24.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_24.f90 new file mode 100644 index 00000000000..6bd4709aa66 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_24.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-options -std=f95 } +! +! Code was posted to comp.lang.fortran by Richard Maine. +! http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/fff9b3426211c018# +! +module m + type :: foo + real, pointer :: array(:) + procedure (), pointer, nopass :: f ! { dg-error "Procedure pointer component" } + end type +contains + elemental subroutine fooAssgn (a1, a2) + type(foo), intent(out) :: a1 + type(foo), intent(in) :: a2 + allocate (a1%array(size(a2%array))) + + a1%array = a2%array + a1%f => a2%f ! { dg-error "not a member of the" } + end subroutine +end module m -- 2.11.0