https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107508
Bug ID: 107508 Summary: Invalid bounds due to bogus reallocation on assignment with KIND=4 characters Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- In the following code, the bounds change during the assignment but I believe the RHS and the LHS have the same shape and length parameters. As it works with kind=4, I assume that there is a missing '*4' in the size calculation. ! ------------------ implicit none character(len=:,kind=4), allocatable :: a4str(:), a4str2 allocate(character(len=7,kind=4) :: a4str(-2:3)) if (lbound(a4str,1) /= -2) error stop if (ubound(a4str,1) /= 3) error stop a4str = [4_"sf456aq", 4_"3dtzu24", 4_"_4fh7sm", 4_"=ff85s7", 4_"j=8af4d", 4_".,A%Fsz"] print *, lbound(a4str), ubound(a4str) ! expected (-2:3) - actually: (1:6) if (lbound(a4str,1) /= -2) error stop if (ubound(a4str,1) /= 3) error stop end