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]

[Patch, Fortran] PR33188: Fortran 2003 - allow derived type without contained components


:ADDPATCH fortran:

Fortran 95:

4.4.1 Derived-type definition
R422 derived-type-def is derived-type-stmt
                           [ private-sequence-stmt ] ...
                           component-def-stmt
                           [ component-def-stmt ] ...
                         end-type-stmt

Fortran 2003:

4.5.1 Derived-type definition
R429 derived-type-def is derived-type-stmt
                           [ type-param-def-stmt ] ...
                           [ private-or-sequence ] ...
                           [ component-part ]
                           [ type-bound-procedure-part ]
                         end-type-stmt



Regression tested on x86-64/Linux. Ok for the trunk?


Other patches awaing review:

USE operator patch by me:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01081.html

-frecursive/OpenMP patch by Asher and me:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01253.html

COMMON checking patch by me:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01299.html

GAMMA/LGAMMA patch by me:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01386.html

Implement KIND specific floating point formatted  output by Jerry
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01415.html


PR33055 Runtime error in INQUIRE unit existance with -fdefault-integer-8
by Jerry
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01694.html

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

	PR fortran/33188
	* parse.c (parse_derived): Support empty derived type
	definitions for Fortran 2003.

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

	PR fortran/33188
	* gfortran.dg/used_types_18.f90: New.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c	(revision 127806)
+++ gcc/fortran/parse.c	(working copy)
@@ -1544,11 +1549,11 @@ parse_derived (void)
 	case ST_END_TYPE:
 	  compiling_type = 0;
 
-	  if (!seen_component)
-	    {
-	      gfc_error ("Derived type definition at %C has no components");
-	      error_flag = 1;
-	    }
+	  if (!seen_component
+	      && (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Derived type "
+			         "definition at %C without components")
+		  == FAILURE))
+	    error_flag = 1;
 
 	  accept_statement (ST_END_TYPE);
 	  break;
Index: gcc/testsuite/gfortran.dg/used_types_18.f90
===================================================================
--- gcc/testsuite/gfortran.dg/used_types_18.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/used_types_18.f90	(revision 0)
@@ -0,0 +1,12 @@
+! { dg do-compile }
+! { dg-options "-std=f2003" }
+!
+! Fortran 2003 allowes TYPE without components
+! The error message for -std=f95 is tested in
+! gfortran.dg/access_spec_2.f90
+!
+! PR fortran/33188
+!
+type t
+end type
+end

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