This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/85521] [8 Regression] ICE in gfc_resolve_character_array_constructor, at fortran/array.c:2049


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]