This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR 39692: f95: conflict between EXTERNAL and POINTER


Hi all,

here is the simple fix for PR 39692 (actually pretty close to
obvious). Regression-tested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2009-04-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39692
	* symbol.c (check_conflict): Reject procedure pointers for -std=f95.


2009-04-09  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39692
	* gfortran.dg/proc_ptr_14.f90: New.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c	(Revision 145815)
+++ gcc/fortran/symbol.c	(Arbeitskopie)
@@ -455,6 +455,10 @@ check_conflict (symbol_attribute *attr, 
   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);
! { 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]