aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-12-03 16:32:04 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-12-03 15:32:04 +0000
commita34a91f0b73dad394cd0db44f5702406c09a06c6 (patch)
treefed5540ea5770fb73224878dea9cced4affb486c /gcc/fortran/match.c
parent1b2bb2edfa74093b2926ca0673e845edd7f5f8a5 (diff)
downloadgcc-a34a91f0b73dad394cd0db44f5702406c09a06c6.zip
gcc-a34a91f0b73dad394cd0db44f5702406c09a06c6.tar.gz
gcc-a34a91f0b73dad394cd0db44f5702406c09a06c6.tar.bz2
re PR fortran/25106 ([4.0/4.1] statement label is zero)
PR fortran/25106 * parse.c (next_free): Use new prototype for gfc_match_st_label. Correctly emit hard error if a label is zero. * match.c (gfc_match_st_label): Never allow zero as a valid label. (gfc_match, gfc_match_do, gfc_match_goto): Use new prototype for gfc_match_st_label. * primary.c (): Use new prototype for gfc_match_st_label. * io.c (): Likewise. * match.h: Likewise. From-SVN: r107999
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 97e8f5a..8ca7ed6 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -217,7 +217,7 @@ gfc_match_small_int (int *value)
do most of the work. */
match
-gfc_match_st_label (gfc_st_label ** label, int allow_zero)
+gfc_match_st_label (gfc_st_label ** label)
{
locus old_loc;
match m;
@@ -229,13 +229,16 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero)
if (m != MATCH_YES)
return m;
- if (((i == 0) && allow_zero) || i <= 99999)
+ if (i > 0 && i <= 99999)
{
*label = gfc_get_st_label (i);
return MATCH_YES;
}
- gfc_error ("Statement label at %C is out of range");
+ if (i == 0)
+ gfc_error ("Statement label at %C is zero");
+ else
+ gfc_error ("Statement label at %C is out of range");
gfc_current_locus = old_loc;
return MATCH_ERROR;
}
@@ -690,7 +693,7 @@ loop:
case 'l':
label = va_arg (argp, gfc_st_label **);
- n = gfc_match_st_label (label, 0);
+ n = gfc_match_st_label (label);
if (n != MATCH_YES)
{
m = n;
@@ -1242,7 +1245,7 @@ gfc_match_do (void)
if (gfc_match (" do") != MATCH_YES)
return MATCH_NO;
- m = gfc_match_st_label (&label, 0);
+ m = gfc_match_st_label (&label);
if (m == MATCH_ERROR)
goto cleanup;
@@ -1275,7 +1278,7 @@ gfc_match_do (void)
gfc_match_label (); /* This won't error */
gfc_match (" do "); /* This will work */
- gfc_match_st_label (&label, 0); /* Can't error out */
+ gfc_match_st_label (&label); /* Can't error out */
gfc_match_char (','); /* Optional comma */
m = gfc_match_iterator (&iter, 0);
@@ -1585,7 +1588,7 @@ gfc_match_goto (void)
do
{
- m = gfc_match_st_label (&label, 0);
+ m = gfc_match_st_label (&label);
if (m != MATCH_YES)
goto syntax;
@@ -1631,7 +1634,7 @@ gfc_match_goto (void)
do
{
- m = gfc_match_st_label (&label, 0);
+ m = gfc_match_st_label (&label);
if (m != MATCH_YES)
goto syntax;