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

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
> The following adjustment to the logic around the bounds-checking code
> fixes the issue:
> 
> diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> index fbe7333fd71..ed29623fcdf 100644
> --- a/gcc/fortran/trans-expr.cc
> +++ b/gcc/fortran/trans-expr.cc
> @@ -2814,8 +2813,8 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int
> kind,
>      end.expr = gfc_evaluate_now (end.expr, &se->pre);
>  
>    if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
> -      && (ref->u.ss.start->symtree
> -       && !ref->u.ss.start->symtree->n.sym->attr.implied_index))
> +      && !(ref->u.ss.start->symtree
> +       && ref->u.ss.start->symtree->n.sym->attr.implied_index))
>      {
>        tree nonempty = fold_build2_loc (input_location, LE_EXPR,
>                                      logical_type_node, start.expr,
> 
> Needs regtesting.

The previous version was introduced with the fix for pr98490.
So the current issue is actually a 9/10/.../15 regression...

Reply via email to