From 6d2ae4727da2689156f177de963ccbc2e2a7e6b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Thu, 8 Sep 2005 23:55:59 +0200 Subject: [PATCH] re PR fortran/23765 (segfault with syntactically wrong common declaration) 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 | 6 ++++++ gcc/fortran/match.c | 6 ------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/common_6.f90 | 10 ++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/common_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 50053400d95..f1974a39c06 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2005-09-08 Tobias Schl"uter + + PR fortran/23765 + * match.c (gfc_match_common): Remove unnecessary / wrong special + cases for end-of-statement. + 2005-09-08 Janne Blomqvist * gfortran.texi: Add section about implemented F2003 features. diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 87737fcced5..67c7c96f1dd 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4fa4a7dd3fe..f6ab8fba3cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-09-08 Tobias Schl"uter + + PR fortran/23765 + * gfortran.dg/common_6.f90: New test. + 2005-09-08 Mark Mitchell 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 index 00000000000..8cef179e74f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/common_6.f90 @@ -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 -- 2.30.2