public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107508] New: Invalid bounds due to bogus reallocation on assignment with KIND=4 characters
@ 2022-11-02 13:13 burnus at gcc dot gnu.org
  2022-11-07 10:33 ` [Bug fortran/107508] " cvs-commit at gcc dot gnu.org
  2023-01-12 21:23 ` anlauf at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-11-02 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-12 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 13:13 [Bug fortran/107508] New: Invalid bounds due to bogus reallocation on assignment with KIND=4 characters burnus at gcc dot gnu.org
2022-11-07 10:33 ` [Bug fortran/107508] " cvs-commit at gcc dot gnu.org
2023-01-12 21:23 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).