re PR fortran/23765 (segfault with syntactically wrong common declaration)
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Thu, 8 Sep 2005 21:55:59 +0000 (23:55 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Thu, 8 Sep 2005 21:55:59 +0000 (23:55 +0200)
fortran/
PR fortran/23765
* match.c (gfc_match_common): Remove unnecessary / wrong special
cases for end-of-statement.
testsuite/
PR fortran/23765
* gfortran.dg/common_6.f90: New test.

From-SVN: r104046

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

index 50053400d9586eb08ebcb54c2fd05816bb45e4c9..f1974a39c0638a70db45310f8e2f4d806ec68003 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-08  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/23765
+       * match.c (gfc_match_common): Remove unnecessary / wrong special
+       cases for end-of-statement.
+
 2005-09-08  Janne Blomqvist  <jblomqvi@cc.hut.fi>
 
        * gfortran.texi: Add section about implemented F2003 features.
index 87737fcced588ab8809d3e4051b838519288a171..67c7c96f1dde81108158c8e8ca741c7f7e1f8376 100644 (file)
@@ -2241,9 +2241,6 @@ gfc_match_common (void)
 
   as = NULL;
 
-  if (gfc_match_eos () == MATCH_YES)
-    goto syntax;
-
   for (;;)
     {
       m = match_common_name (name);
@@ -2273,9 +2270,6 @@ gfc_match_common (void)
        }
 
       /* Grab the list of symbols.  */
-      if (gfc_match_eos () == MATCH_YES)
-       goto done;
-  
       for (;;)
        {
          m = gfc_match_symbol (&sym, 0);
index 4fa4a7dd3fe2f9097f8f569df652d315ffb42a8d..f6ab8fba3cb73f29ad840c1796e213f4323bab61 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-08  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/23765
+       * gfortran.dg/common_6.f90: New test.
+
 2005-09-08  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/23691
diff --git a/gcc/testsuite/gfortran.dg/common_6.f90 b/gcc/testsuite/gfortran.dg/common_6.f90
new file mode 100644 (file)
index 0000000..8cef179
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR 23765 : We used to incorrectly accept common blocks with no symbols
+common          ! { dg-error "Syntax error" }
+common //       ! { dg-error "Syntax error" }
+common /a/      ! { dg-error "Syntax error" }
+common /b/x/c/  ! { dg-error "Syntax error" }
+common y/d/     ! { dg-error "Syntax error" }
+common /e//f/   ! { dg-error "Syntax error" }
+common ///g/    ! { dg-error "Syntax error" }
+end