[gfortran, committed] PR 24008: require argument list for function entries

Tobias.Schlueter@Physik.Uni-Muenchen.DE Tobias.Schlueter@Physik.Uni-Muenchen.DE
Tue Nov 1 21:55:00 GMT 2005


This trivial one-liner fixes a small bug in the parsing of function entries,
where we would allow entry declarations of the form
  ENTRY f RESULT(a)
This is in fact not allowed, but an empty argument list is required.  (Actually,
in fixed form this would be parsed as ENTRY fresult(a), so there is a reason why
the argument list is required.)

Patch together with new testcase below.  I also had to fix an old test.
Bubblestrapped and tested.  Committed to the mainline as r106358.

- Tobi

2005-11-01  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>

        PR fortran/24008
        * decl.c (gfc_match_entry): Function entries need an argument list.


Index: fortran/decl.c
===================================================================
--- fortran/decl.c      (revision 106345)
+++ fortran/decl.c      (working copy)
@@ -2691,7 +2691,7 @@ gfc_match_entry (void)
   else
     {
       /* An entry in a function.  */
-      m = gfc_match_formal_arglist (entry, 0, 1);
+      m = gfc_match_formal_arglist (entry, 0, 0);
       if (m != MATCH_YES)
        return MATCH_ERROR;

Index: testsuite/gfortran.dg/entry_5.f90
===================================================================
--- testsuite/gfortran.dg/entry_5.f90   (revision 0)
+++ testsuite/gfortran.dg/entry_5.f90   (revision 0)
@@ -0,0 +1,10 @@
+! PR 24008
+! an argument list to the entry is required
+REAL FUNCTION funct()
+  funct = 0.0
+  RETURN
+!
+  ENTRY enter RESULT (answer)  ! { dg-error "Unclassifiable statement" }
+  answer = 1.0
+  RETURN
+END FUNCTION funct
Index: testsuite/gfortran.fortran-torture/execute/entry_9.f90
===================================================================
--- testsuite/gfortran.fortran-torture/execute/entry_9.f90      (revision
106345)
+++ testsuite/gfortran.fortran-torture/execute/entry_9.f90      (working copy)
@@ -5,12 +5,12 @@
        integer a, f1, e1
        f1 = 15 + a
        return
-       entry e1
+       entry e1()
        e1 = 42
        end function
        function f2 ()
        real f2, e2
-       entry e2
+       entry e2()
        e2 = 45
        end function





More information about the Fortran mailing list