https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117774
kargls at comcast dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargls at comcast dot net
--- Comment #2 from kargls at comcast dot net ---
(In reply to anlauf from comment #1)
> Confirmed.
>
> There are several related bugs with imaginary part references, and likely
> a duplicate or two.
>
> A rank-1 array x is sufficient to reproduce the ICE.
Either of the following patches cure the issue. The first is
the classic NULL pointer deference fix.
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index a3c1dc0b7af..86b0469b3dc 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7400,7 +7400,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
for (ref = e->ref; ref->next; ref = ref->next)
;
if (ref->u.ar.type == AR_FULL
- && ref->u.ar.as->type != AS_ASSUMED_SIZE)
+ && ref->u.ar.as && ref->u.ar.as->type != AS_ASSUMED_SIZE)
ref->u.ar.type = AR_SECTION;
}
The second skips the code for an inquiry reference.
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index a3c1dc0b7af..8b50a3b852b 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7399,7 +7399,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
gfc_ref *ref;
for (ref = e->ref; ref->next; ref = ref->next)
;
- if (ref->u.ar.type == AR_FULL
+ if (ref->type != REF_INQUIRY
+ && ref->u.ar.type == AR_FULL
&& ref->u.ar.as->type != AS_ASSUMED_SIZE)
ref->u.ar.type = AR_SECTION;
}