summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-11 10:30:29 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-11 10:30:29 +0000
commit72ac71f6b3cb6dcc7341021b7cb3b396145ceb3e (patch)
treea3351bfe9f451b4c12f87233dac962a0169370dc
parent8ad54c540a80d029cb36fbc242c0b25a6c6b9fa7 (diff)
downloadgcc-72ac71f6b3cb6dcc7341021b7cb3b396145ceb3e.tar.gz
2009-04-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/39692 * symbol.c (check_conflict): Reject procedure pointers for -std=f95. 2009-04-11 Janus Weil <janus@gcc.gnu.org> PR fortran/39692 * gfortran.dg/proc_ptr_14.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145955 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/symbol.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_14.f9040
4 files changed, 55 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 9ecdf7272bd..99a09badef9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,4 +1,9 @@
-2009-04-11 Daniel Franke <frake.daniel@gmail.com>
+2009-04-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39692
+ * symbol.c (check_conflict): Reject procedure pointers for -std=f95.
+
+2009-04-11 Daniel Franke <franke.daniel@gmail.com>
* resolve.c (resolve_global_procedure): Enable whole-file checking for
procedures that are declared later in the file.
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index a4f43a5f670..ea4946b8850 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -455,6 +455,10 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
if ((attr->if_source == IFSRC_DECL && !attr->procedure) || attr->contained)
conf (external, subroutine);
+ if (attr->proc_pointer && gfc_notify_std (GFC_STD_F2003,
+ "Fortran 2003: Procedure pointer at %C") == FAILURE)
+ return FAILURE;
+
conf (allocatable, pointer);
conf_std (allocatable, dummy, GFC_STD_F2003);
conf_std (allocatable, function, GFC_STD_F2003);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aedd017f189..4acc4b9d001 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39692
+ * gfortran.dg/proc_ptr_14.f90: New.
+
2009-04-11 Richard Guenther <rguenther@suse.de>
PR middle-end/39732
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_14.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_14.f90
new file mode 100644
index 00000000000..90037a1a5ab
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_14.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR 39692: f95: conflict between EXTERNAL and POINTER
+!
+! Test for Procedure Pointers (without PROCEDURE statements) with the -std=f95 flag.
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+pointer :: f
+external :: f ! { dg-error "Fortran 2003: Procedure pointer" }
+
+external :: g
+pointer :: g ! { dg-error "Fortran 2003: Procedure pointer" }
+
+real, pointer, external :: h ! { dg-error "Fortran 2003: Procedure pointer" }
+
+interface
+ subroutine i
+ end subroutine i
+end interface
+pointer :: i ! { dg-error "Fortran 2003: Procedure pointer" }
+
+pointer :: j
+interface
+ real function j()
+ end function j ! { dg-error "Fortran 2003: Procedure pointer" }
+end interface
+
+contains
+
+ function k() ! { dg-error "attribute conflicts with" }
+ intrinsic sin
+ external k
+ pointer k ! { dg-error "Fortran 2003: Procedure pointer" }
+ real k
+ end function k
+
+end
+