From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EF73C3858CDA; Wed, 2 Nov 2022 13:13:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF73C3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667394836; bh=NNfaP6ZA7Q23Wr5FNWKbAFqQpPeRljm4Wb4zC4HTG5w=; h=From:To:Subject:Date:From; b=RV3xsa39owbK0tNna0Kgm/RGTLwzRxk3U5EZtynQPBKeuSJrNUOrS/U87fnzhapOU RKgz81C8WYJWDEdvRd4E8vjq3qVtXG6FvfflpoUxb71xsJ+hj6mrSVxesJZKr95q1g VZSf39g/Yk8EhuazgnUkidlseO7lLedbjENwTF+8= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/107508] New: Invalid bounds due to bogus reallocation on assignment with KIND=4 characters Date: Wed, 02 Nov 2022 13:13:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107508 Bug ID: 107508 Summary: Invalid bounds due to bogus reallocation on assignment with KIND=3D4 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=3D4, I assume that there is a missing '*4' in the size calculation. ! ------------------ implicit none character(len=3D:,kind=3D4), allocatable :: a4str(:), a4str2 allocate(character(len=3D7,kind=3D4) :: a4str(-2:3)) if (lbound(a4str,1) /=3D -2) error stop if (ubound(a4str,1) /=3D 3) error stop a4str =3D [4_"sf456aq", 4_"3dtzu24", 4_"_4fh7sm", 4_"=3Dff85s7", 4_"j=3D8af= 4d", 4_".,A%Fsz"] print *, lbound(a4str), ubound(a4str) ! expected (-2:3) - actually: (1:6) if (lbound(a4str,1) /=3D -2) error stop if (ubound(a4str,1) /=3D 3) error stop end=