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

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to Harald Anlauf from comment #6)
> (In reply to Jerry DeLisle from comment #5)
> > I will get on this one since it bisected to something I did.
> 
> Thanks.
> 
> Note we hit the assert in trans-array.cc:
> 
> 8778              /* Vector subscripts need copying and are handled
> elsewhere.  */
> 8779              if (info->ref)
> 8780                gcc_assert (info->ref->u.ar.dimen_type[n] ==
> DIMEN_RANGE);
> 
> dimen_type has a DIMEN_VECTOR for one of the dimensions.

As far as I can tell, the blameed commit uncovered this one.

The fix:

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 61e5611e1a7..aee183a5fef 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8251,7 +8251,9 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
       substr = info->ref && info->ref->next
               && info->ref->next->type == REF_SUBSTRING;

+      /* A vector subscript always needs a temporary.  */
       subref_array_target = (is_subref_array (expr)
+                            && !gfc_has_vector_subscript (expr)
                             && (se->direct_byref
                                 || se->force_no_tmp
                                 || expr->ts.type == BT_CHARACTER));

Reply via email to