]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/14066 (Infinite DO loops not recognized.)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Fri, 14 May 2004 13:46:05 +0000 (15:46 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Fri, 14 May 2004 13:46:05 +0000 (15:46 +0200)
fortran:
        PR fortran/14066
* match.c (gfc_match_do): Allow infinite loops with
label-do-stmt. Do not enforce space after comma.

testsuite:

PR fortran/14066
* gfortran.fortran-torture/compile/do_1.f90: New test.

Also fixed date on previous ChangeLog entries.

From-SVN: r81842

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/do_1.f90 [new file with mode: 0644]

index ab9f8ba48235e486a0852d44506b640f26535eda..9e3741a83f5ebd8a2748a6f7d59222eaa5ca31f8 100644 (file)
@@ -1,10 +1,16 @@
-2004-05-08  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+        PR fortran/14066
+       * match.c (gfc_match_do): Allow infinite loops with
+       label-do-stmt. Do not enforce space after comma.
+
+2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
         PR fortran/15051
        * parse.c (parse_interface): Allow empty INTERFACE, remove
         seen_body.
 
-2004-05-08  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * Make-lang.in, arith.c, arith.h, array.c, bbt.c, check.c,
        decl.c, dependency.c, dependency.h, dump-parse-tree.c, error.c,
@@ -20,7 +26,7 @@
        * data.c: Likewise, also removed two whitespace-only lines.
        * gfortranspec.c, lang.opt: Update copyright years.
 
-2004-04-22  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/14568
        * trans-decl.c (generate_local_decl): Don't warn for unused
index 28fe7a60e1e2b61bf07e42f11f92e14cfed3c758..fc5afbfcc5da6e2b0cd1dcd9a4e5b29b12e52881 100644 (file)
@@ -1203,6 +1203,10 @@ gfc_match_do (void)
   if (gfc_match (" do") != MATCH_YES)
     return MATCH_NO;
 
+  m = gfc_match_st_label (&label, 0);
+  if (m == MATCH_ERROR)
+    goto cleanup;
+
 /* Match an infinite DO, make it like a DO WHILE(.TRUE.) */
 
   if (gfc_match_eos () == MATCH_YES)
@@ -1212,13 +1216,9 @@ gfc_match_do (void)
       goto done;
     }
 
-  m = gfc_match_st_label (&label, 0);
-  if (m == MATCH_ERROR)
-    goto cleanup;
-
-  gfc_match_char (',');
-
-  if (gfc_match ("% ") != MATCH_YES)
+  /* match an optional comma, if no comma is found a space is obligatory.  */
+  if (gfc_match_char(',') != MATCH_YES
+      && gfc_match ("% ") != MATCH_YES)
     return MATCH_NO;
 
   /* See if we have a DO WHILE.  */
index 6baf19a46ee2a5ecc4a3c4563e202042f2a528e6..216d3e8c205a1c33d217b7a34693f28bcc688585 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/14066
+       * gfortran.fortran-torture/compile/do_1.f90: New test.
+
 2004-05-14  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/15051
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/do_1.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/do_1.f90
new file mode 100644 (file)
index 0000000..396592c
--- /dev/null
@@ -0,0 +1,28 @@
+! test various forms of the DO statement
+! inspired by PR14066
+LOGICAL L
+DO i=1,10
+END DO
+DO 10 i=1,20
+   DO 20,j=1,10,2
+20 CONTINUE
+10 END DO
+L = .TRUE.
+DO WHILE(L)
+   L = .FALSE.
+END DO
+DO 50 WHILE(.NOT.L)
+   L = .TRUE.
+50 CONTINUE
+DO
+   DO 30
+      DO 40
+40    CONTINUE
+30 END DO
+END DO
+outer: DO i=1,20
+   inner: DO,j=i,30
+      IF (j.EQ.2*i) CYCLE outer
+   END DO inner
+END DO outer
+END
This page took 0.105157 seconds and 5 git commands to generate.