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

anlauf at gcc dot gnu.org changed:

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
The following patch appears to fix the ICE and produce working code:

diff --git a/gcc/fortran/array.cc b/gcc/fortran/array.cc
index 3a6e3a7c95b..0cb636b22c4 100644
--- a/gcc/fortran/array.cc
+++ b/gcc/fortran/array.cc
@@ -2597,6 +2597,13 @@ gfc_array_dimen_size (gfc_expr *array, int dimen, mpz_t
*result)
     case EXPR_FUNCTION:
       for (ref = array->ref; ref; ref = ref->next)
        {
+         /* Ultimate component is a procedure pointer.  */
+         if (ref->type == REF_COMPONENT
+             && !ref->next
+             && ref->u.c.component->attr.function
+             && IS_PROC_POINTER (ref->u.c.component))
+           return false;
+
          if (ref->type != REF_ARRAY)
            continue;

Reply via email to