re PR fortran/18869 (multiple common blocks in a single line rejected)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Sun, 12 Dec 2004 21:12:00 +0000 (22:12 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sun, 12 Dec 2004 21:12:00 +0000 (22:12 +0100)
gcc/
PR fortran/18869
* match.c (gfc_match_common): Skip whitespace.

testsuite/
PR fortran/18869
* gfortran.dg/common_1.f90: New test.

From-SVN: r92064

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/common_1.f90 [new file with mode: 0644]

index 7c63b51b5c144999fb69def6b34dde7877ec1d7c..d000e033279d38119ca5c10db394cad11ff9871a 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-12  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/18869
+       * match.c (gfc_match_common): Skip whitespace.
+
 2004-12-12  Steven G. Kargl  <kargls@comcast.net>
 
        PR fortran/16581
index 210de97de90dd914c085b0fd40d2637fe0a2bfa7..cf0c255524de7c20a015e730e8bd501fb827396c 100644 (file)
@@ -2306,12 +2306,14 @@ gfc_match_common (void)
              as = NULL;
            }
 
+         gfc_gobble_whitespace ();
          if (gfc_match_eos () == MATCH_YES)
            goto done;
          if (gfc_peek_char () == '/')
            break;
          if (gfc_match_char (',') != MATCH_YES)
            goto syntax;
+         gfc_gobble_whitespace ();
          if (gfc_peek_char () == '/')
            break;
        }
index 1777427a0fd55da2d4a7da4dd84db371eff94c42..05eed5adcda4677f4c30ec8a837a37e63d2b4c4b 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-12  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/18869
+       * gfortran.dg/common_1.f90: New test.
+
 2004-12-12  Steven G. Kargl  <kargls@comcast.net>
        Paul Brook  <paul@codesourcery.com>
 
diff --git a/gcc/testsuite/gfortran.dg/common_1.f90 b/gcc/testsuite/gfortran.dg/common_1.f90
new file mode 100644 (file)
index 0000000..6ee146a
--- /dev/null
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! tests various allowed variants of the common statement
+! inspired by PR 18869
+
+! blank common block
+      common x
+      common y, z
+      common // xx
+
+! one named common block on a line
+      common /a/ e
+      
+! appending to a common block
+      common /a/ g
+
+! several named common blocks on a line
+      common /foo/ a, /bar/ b      ! note 'a' is also the name of the 
+                                   ! above common block
+      common /baz/ c /foobar/ d, /bazbar/ f
+
+      end