aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2008-05-16 16:44:28 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2008-05-16 16:44:28 +0000
commitacb388a0cb8503c7ee94a74c725903e539a19115 (patch)
tree6527e06cef13e036e6dae35e43a6daa568e57d2f /gcc
parentd1325932580a13fea6ce6e257c30e756405d5ac3 (diff)
downloadgcc-acb388a0cb8503c7ee94a74c725903e539a19115.zip
gcc-acb388a0cb8503c7ee94a74c725903e539a19115.tar.gz
gcc-acb388a0cb8503c7ee94a74c725903e539a19115.tar.bz2
re PR fortran/34325 (Wrong error message for syntax error)
2008-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/34325 * decl.c (match_attr_spec): Check for matching pairs of parenthesis. * expr.c (gfc_specification_expr): Supplement the error message with the type that was found. * resolve.c (gfc_resolve_index): Likewise. * match.c (gfc_match_parens): Clarify error message with "at or before". (gfc_match_do): Check for matching pairs of parenthesis. From-SVN: r135428
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog10
-rw-r--r--gcc/fortran/decl.c7
-rw-r--r--gcc/fortran/expr.c3
-rw-r--r--gcc/fortran/match.c10
-rw-r--r--gcc/fortran/resolve.c4
5 files changed, 28 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 51a82c9..73bd3e2 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,13 @@
+2008-05-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/34325
+ * decl.c (match_attr_spec): Check for matching pairs of parenthesis.
+ * expr.c (gfc_specification_expr): Supplement the error message with the
+ type that was found.
+ * resolve.c (gfc_resolve_index): Likewise.
+ * match.c (gfc_match_parens): Clarify error message with "at or before".
+ (gfc_match_do): Check for matching pairs of parenthesis.
+
2008-05-16 Tobias Burnus <burnus@net-b.de
* intrinsic.texi: Write Fortran 77/90/95 instead of F77/90/95;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 24606c4..5a1ce03 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2934,6 +2934,13 @@ match_attr_spec (void)
goto cleanup;
}
+ /* Check to make sure any parens are paired up correctly. */
+ if (gfc_match_parens () == MATCH_ERROR)
+ {
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+
seen[d]++;
seen_at[d] = gfc_current_locus;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 87ea9e9..e6c1e4e 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2573,7 +2573,8 @@ gfc_specification_expr (gfc_expr *e)
if (e->ts.type != BT_INTEGER)
{
- gfc_error ("Expression at %L must be of INTEGER type", &e->where);
+ gfc_error ("Expression at %L must be of INTEGER type, found %s",
+ &e->where, gfc_basic_typename (e->ts.type));
return FAILURE;
}
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 8c83615..d3f665f 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -153,12 +153,12 @@ gfc_match_parens (void)
if (count > 0)
{
- gfc_error ("Missing ')' in statement before %L", &where);
+ gfc_error ("Missing ')' in statement at or before %L", &where);
return MATCH_ERROR;
}
if (count < 0)
{
- gfc_error ("Missing '(' in statement before %L", &where);
+ gfc_error ("Missing '(' in statement at or before %L", &where);
return MATCH_ERROR;
}
@@ -553,7 +553,6 @@ gfc_match_name (char *buffer)
return MATCH_ERROR;
}
-
buffer[i] = '\0';
gfc_current_locus = old_loc;
@@ -1749,6 +1748,11 @@ gfc_match_do (void)
if (gfc_match_char (',') != MATCH_YES && gfc_match ("% ") != MATCH_YES)
return MATCH_NO;
+ /* Check for balanced parens. */
+
+ if (gfc_match_parens () == MATCH_ERROR)
+ return MATCH_ERROR;
+
/* See if we have a DO WHILE. */
if (gfc_match (" while ( %e )%t", &iter.end) == MATCH_YES)
{
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 6338b06..bf88624 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3510,8 +3510,8 @@ gfc_resolve_index (gfc_expr *index, int check_scalar)
if (index->ts.type != BT_INTEGER && index->ts.type != BT_REAL)
{
- gfc_error ("Array index at %L must be of INTEGER type",
- &index->where);
+ gfc_error ("Array index at %L must be of INTEGER type, found %s",
+ &index->where, gfc_basic_typename (index->ts.type));
return FAILURE;
}