| Submitter | Daniel Kraft |
|---|---|
| Date | July 29, 2010, 7:49 a.m. |
| Message ID | <4C513275.7010802@domob.eu> |
| Download | mbox | patch |
| Permalink | /patch/60195/ |
| State | New |
| Headers | show |
Comments
Daniel Kraft wrote: > Hi all, > > this small patch fixes PR 45117. The problem (obviously) was that the > error reporting assumed the expression to be of type variable (which is > also clear from the message text), and for non-variable expressions I > introduced a new alternative. > > Ok for trunk if no regressions on GNU/Linux-x86-32? There were no regressions. Committed as rev. 162670 after Tobias reviewed it on IRC. Daniel
Patch
Index: gcc/fortran/array.c =================================================================== --- gcc/fortran/array.c (revision 162647) +++ gcc/fortran/array.c (working copy) @@ -300,10 +300,14 @@ resolve_array_bound (gfc_expr *e, int ch || 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; }