summaryrefslogtreecommitdiff
path: root/gcc/fortran/array.c
diff options
context:
space:
mode:
authordomob <domob@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-29 09:06:53 +0000
committerdomob <domob@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-29 09:06:53 +0000
commit40df139cb062b310b7a7bc20dc4dc49b8a56f306 (patch)
treee9e7a5c29a070c17c7a37c78e616f304852df4c3 /gcc/fortran/array.c
parentb219ece3e547a90a4b857c73c9e87ce2c21fcc36 (diff)
downloadgcc-40df139cb062b310b7a7bc20dc4dc49b8a56f306.tar.gz
2010-07-29 Daniel Kraft <d@domob.eu>
PR fortran/45117 * array.c (resolve_array_bound): Fix error message to properly handle non-variable expressions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162670 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/array.c')
-rw-r--r--gcc/fortran/array.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 68b6456cdbc..e45f7e45c7f 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -300,10 +300,14 @@ resolve_array_bound (gfc_expr *e, int check_constant)
|| gfc_specification_expr (e) == FAILURE)
return FAILURE;
- if (check_constant && gfc_is_constant_expr (e) == 0)
+ if (check_constant && !gfc_is_constant_expr (e))
{
- gfc_error ("Variable '%s' at %L in this context must be constant",
- e->symtree->n.sym->name, &e->where);
+ if (e->expr_type == EXPR_VARIABLE)
+ gfc_error ("Variable '%s' at %L in this context must be constant",
+ e->symtree->n.sym->name, &e->where);
+ else
+ gfc_error ("Expression at %L in this context must be constant",
+ &e->where);
return FAILURE;
}