[Bug fortran/108527] [13 Regression] ICE in compare_bound_int(): Bad expression

anlauf at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 24 18:42:39 GMT 2023


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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-01-24
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from anlauf at gcc dot gnu.org ---
Oh well.

This fixes at least the first testcase:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 94213cd3cd4..65e689c6f10 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -4732,6 +4732,10 @@ check_dimension (int i, gfc_array_ref *ar,
gfc_array_spec *as)
 #define AR_START (ar->start[i] ? ar->start[i] : as->lower[i])
 #define AR_END (ar->end[i] ? ar->end[i] : as->upper[i])

+       /* Something has already gone wrong.  Allow sane recovery.  */
+       if (ar->stride[i] == NULL)
+         return false;
+
        compare_result comp_start_end = compare_bound (AR_START, AR_END);

        /* Check for zero stride, which is not allowed.  */


More information about the Gcc-bugs mailing list