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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #4 from kargl at gcc dot gnu.org ---
gfc_resolve_character_array_constructor in array.c is not prepared
for a clever user who causes a zero length component by purposely
reference a string with an upper bound less than the lower bound.
This fixes the problem by setting a negative length to zero.

Index: gcc/fortran/array.c
===================================================================
--- gcc/fortran/array.c (revision 259623)
+++ gcc/fortran/array.c (working copy)
@@ -2046,7 +2046,8 @@ got_charlen:
          else
            return true;

-         gcc_assert (current_length != -1);
+         if (current_length < 0)
+           current_length = 0;

          if (found_length == -1)
            found_length = current_length;

Reply via email to