This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: ABSTRACT interfaces + PROCEDURE declarations


Janus Weil wrote:
> Errr  ... there is no patch. I guess you just forgot to attach it?!?
>   
Probably. Try this one.

Tobias

	* decl.c (gfc_match_bind_c): Check for NAME= with abstract interfaces.
	(access_attr_decl): Handle Abstract interfaces.

2007-08-17  Tobias Burnus  <burnus@net-b.de>

	* gfortran.dg/interface_abstract_1.f90: New.

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 127586)
+++ gcc/fortran/decl.c	(working copy)
@@ -4183,6 +4183,12 @@ gfc_match_bind_c (gfc_symbol *sym)
 	strncpy (sym->binding_label, sym->name, strlen (sym->name) + 1);
     }
 	      
+  if (has_name_equals && current_interface.type == INTERFACE_ABSTRACT)
+    {
+      gfc_error ("NAME not allowed on BIND(C) for ABSTRACT INTERFACE at %C");
+      return MATCH_ERROR;
+    }
+
   return MATCH_YES;
 }
 
@@ -4842,6 +4848,7 @@ access_attr_decl (gfc_statement st)
       switch (type)
 	{
 	case INTERFACE_NAMELESS:
+	case INTERFACE_ABSTRACT:
 	  goto syntax;
 
 	case INTERFACE_GENERIC:
Index: gcc/testsuite/gfortran.dg/interface_abstract_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/interface_abstract_1.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/interface_abstract_1.f90	(revision 0)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+implicit none
+abstract interface :: one ! { dg-error "Syntax error in ABSTRACT INTERFACE statement" }
+end interface ! { dg-error "Expecting END PROGRAM statement" }
+
+abstract interface
+  subroutine two() bind(C)
+  end subroutine two
+  subroutine three() bind(C,name="three") ! { dg-error "NAME not allowed on BIND.C. for ABSTRACT INTERFACE" }
+  end subroutine three ! { dg-error "Expecting END INTERFACE statement" }
+  subroutine real() ! { dg-error "cannot be be the same as an intrinsic type" }
+  end subroutine real
+end interface
+end

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