[Bug fortran/71203] ICE in add_init_expr_to_sym, at fortran/decl.c:1512 and :1564

anlauf at gmx dot de gcc-bugzilla@gcc.gnu.org
Tue Jan 16 21:25:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71203

--- Comment #7 from Harald Anlauf <anlauf at gmx dot de> ---
Attempting to "fix" the negative length issue with

Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 256671)
+++ gcc/fortran/expr.c  (working copy)
@@ -1677,6 +1677,8 @@
   end = (int) mpz_get_ui (p->ref->u.ss.end->value.integer);
   start = (int) mpz_get_ui (p->ref->u.ss.start->value.integer);
   length = end - start + 1;
+  if (end < start)
+    length = 0;

   chr = (*newp)->value.character.string = gfc_get_wide_string (length + 1);
   (*newp)->value.character.length = length;

leads to z3a and z3b crashing the same way.
Which is sort of more consistent than before.

:-(


More information about the Gcc-bugs mailing list