aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c26
1 files changed, 24 insertions, 2 deletions
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;