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] PR36459: Wrong interface use for PROCEDURE


Hi all,
here is my fix for PR36459. It survives "make check-gfortran" without
any failures on i686-pc-linux-gnu. Ok for trunk?
Cheers,
Janus
2008-06-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36459
	* decl.c (match_procedure_decl): Correctly recognize if the interface
	is an intrinsic procedure.

2008-06-08  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36459
	* gfortran.dg/proc_decl_16.f90: New.

Index: gcc/testsuite/gfortran.dg/proc_decl_16.f90
===================================================================
--- gcc/testsuite/gfortran.dg/proc_decl_16.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/proc_decl_16.f90	(revision 0)
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! PR fortran/36459
+!
+abstract interface
+  function dim()
+    integer :: dim
+  end function dim
+end interface
+procedure(dim) :: f
+
+interface
+  integer function tan()
+  end function
+end interface
+procedure(tan) :: g
+
+print *, f()
+
+print *, tan()
+
+end
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 136554)
+++ gcc/fortran/decl.c	(working copy)
@@ -4085,8 +4085,10 @@ match_procedure_decl (void)
 	  return MATCH_ERROR;
 	}
       /* Handle intrinsic procedures.  */
-      if (gfc_intrinsic_name (proc_if->name, 0)
-	  || gfc_intrinsic_name (proc_if->name, 1))
+      if (!(proc_if->attr.external || proc_if->attr.use_assoc
+	    || proc_if->attr.if_source == IFSRC_IFBODY)
+	  && (gfc_intrinsic_name (proc_if->name, 0)
+	      || gfc_intrinsic_name (proc_if->name, 1)))
 	proc_if->attr.intrinsic = 1;
       if (proc_if->attr.intrinsic
 	  && !gfc_intrinsic_actual_ok (proc_if->name, 0))

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