re PR fortran/45117 (Segfault in resolve_array_bound)

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.

From-SVN: r162670
This commit is contained in:
Daniel Kraft 2010-07-29 11:06:53 +02:00 committed by Daniel Kraft
parent 61869cc95e
commit 2b868bf548
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
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.
2010-07-28 Mikael Morin <mikael@gcc.gnu.org>
* decl.c (free_value): Also free repeat field.

View File

@ -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;
}