diff mbox

[Fortran] PR fortran/45117: Fix error message

Message ID 4C513275.7010802@domob.eu
State New
Headers show

Commit Message

Daniel Kraft July 29, 2010, 7:49 a.m. UTC
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?

Daniel

Comments

Daniel Kraft July 29, 2010, 9:12 a.m. UTC | #1
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
diff mbox

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