]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/45117 (Segfault in resolve_array_bound)
authorDaniel Kraft <d@domob.eu>
Thu, 29 Jul 2010 09:06:53 +0000 (11:06 +0200)
committerDaniel Kraft <domob@gcc.gnu.org>
Thu, 29 Jul 2010 09:06:53 +0000 (11:06 +0200)
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

gcc/fortran/ChangeLog
gcc/fortran/array.c

index 37da9fd5d44dacc2acac4818ffb9faa3c9dbcf83..4e3fb7dfb65d1db1777f93d67ec296e7832d34dd 100644 (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.
index 68b6456cdbc32920c13d5202d8177d5b9ce6496a..e45f7e45c7f3865c4baacb30096155ed75628091 100644 (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;
     }