diff options
author | Tobias Schlüter <tobi@gcc.gnu.org> | 2006-07-01 17:03:30 +0200 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2006-07-01 17:03:30 +0200 |
commit | 31c5eee1026f4500fff0f655e6b224cc0e94a6a5 (patch) | |
tree | 1eb307f6fa4e38e619d276c51d3bc7619e1bbd41 | |
parent | 3e72a66fcdc314a8fd2a785d6252ddc61d8456d0 (diff) | |
download | gcc-31c5eee1026f4500fff0f655e6b224cc0e94a6a5.zip gcc-31c5eee1026f4500fff0f655e6b224cc0e94a6a5.tar.gz gcc-31c5eee1026f4500fff0f655e6b224cc0e94a6a5.tar.bz2 |
re PR fortran/19259 (";" as first nonblank character on a line should be an error)
2006-07-01 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
fortran/
PR fortran/19259
* parse.c (next_free): Error out on line starting with semicolon.
(next_fixed): Fix formatting. Error out on line starting with
semicolon.
testsuite/
PR fortran/19259
* gfortran.dg/semicolon_fixed.c: New.
* gfortran.dg/semicolon_free.c: New.
From-SVN: r115115
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/parse.c | 26 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/semicolon_fixed.f | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/semicolon_free.f90 | 9 |
5 files changed, 55 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 04fcea2f..84ecdae 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2006-07-01 Tobias Schlter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/19259 + * parse.c (next_free): Error out on line starting with semicolon. + (next_fixed): Fix formatting. Error out on line starting with + semicolon. + 2006-06-30 Kazu Hirata <kazu@codesourcery.com> * check.c: Fix a comment typo. diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 5b98d1d..972805e 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -410,8 +410,9 @@ static gfc_statement next_free (void) { match m; - int c, d, cnt; + int c, d, cnt, at_bol; + at_bol = gfc_at_bol (); gfc_gobble_whitespace (); c = gfc_peek_char (); @@ -447,6 +448,14 @@ next_free (void) gfc_gobble_whitespace (); + if (at_bol && gfc_peek_char () == ';') + { + gfc_error_now + ("Semicolon at %C needs to be preceded by statement"); + gfc_next_char (); /* Eat up the semicolon. */ + return ST_NONE; + } + if (gfc_match_eos () == MATCH_YES) { gfc_warning_now @@ -474,6 +483,13 @@ next_free (void) } } + if (at_bol && c == ';') + { + gfc_error_now ("Semicolon at %C needs to be preceded by statement"); + gfc_next_char (); /* Eat up the semicolon. */ + return ST_NONE; + } + return decode_statement (); } @@ -571,7 +587,7 @@ next_fixed (void) if (c == '\n') goto blank_line; - if (c != ' ' && c!= '0') + if (c != ' ' && c != '0') { gfc_buffer_error (0); gfc_error ("Bad continuation line at %C"); @@ -593,6 +609,12 @@ next_fixed (void) goto blank_line; gfc_current_locus = loc; + if (c == ';') + { + gfc_error_now ("Semicolon at %C needs to be preceded by statement"); + return ST_NONE; + } + if (gfc_match_eos () == MATCH_YES) goto blank_line; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 92f0427..617aef5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-07-01 Tobias Schlter <tobias.schlueter@physik.uni-muenchen.de> + + PR fortran/19259 + * gfortran.dg/semicolon_fixed.c: New. + * gfortran.dg/semicolon_free.c: New. + 2006-06-30 Mike Stump <mrs@apple.com> * g++.dg/ext/visibility/fvisibility-override2.C: Fix for systems diff --git a/gcc/testsuite/gfortran.dg/semicolon_fixed.f b/gcc/testsuite/gfortran.dg/semicolon_fixed.f new file mode 100644 index 0000000..2c667ae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/semicolon_fixed.f @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR 19259 Semicolon cannot start a line + x=1; y=1; + x=2;; + x=3; + ; ! { dg-error "Semicolon at" } + ;; ! { dg-error "Semicolon at" } + 900 ; ! { dg-error "Semicolon at" } + end diff --git a/gcc/testsuite/gfortran.dg/semicolon_free.f90 b/gcc/testsuite/gfortran.dg/semicolon_free.f90 new file mode 100644 index 0000000..28e8da2 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/semicolon_free.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR 19259 Semicolon cannot start a line +x=1; y=1; +x=2;; +x=3; + ; ! { dg-error "Semicolon at" } +;; ! { dg-error "Semicolon at" } +111 ; ! { dg-error "Semicolon at" } +end |