https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98490
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org --- Comment #8 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Steve Kargl from comment #7) > On Sat, Jan 02, 2021 at 04:12:27AM +0000, jvdelisle at charter dot net wrote: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98490 > > > > --- Comment #5 from Jerry DeLisle <jvdelisle at charter dot net> --- > > Patch regresses several test cases. > > > > This regresses okay. > > diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c > index 14361a10f68..b860f7eaa26 100644 > --- a/gcc/fortran/trans-expr.c > +++ b/gcc/fortran/trans-expr.c > @@ -2537,7 +2537,9 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int > kind, > if (!CONSTANT_CLASS_P (tmp) && !DECL_P (tmp)) > end.expr = gfc_evaluate_now (end.expr, &se->pre); > > - if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) > + if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) > + && (ref->u.ss.start->symtree > + && !ref->u.ss.start->symtree->n.sym->attr.implied_index)) > { > tree nonempty = fold_build2_loc (input_location, LE_EXPR, > > My test program without the dejagnu stuff. > > program test > > implicit none > > call sub('Lorem ipsum') > > contains > > subroutine sub( text ) > character(len=*), intent(in) :: text > character(len=1), allocatable ::c(:) > integer :: i > c = [ ( text(i:i), i = 1, len(text) ) ] > if (c(1) /= 'L') stop 1 > end subroutine sub > > end program test Hi Steve and Jerry, This is OK to commit to master. I would suggest cherry-picking to 9- and 10-branches too. Cheers Paul