From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 884C63858C50; Tue, 28 Mar 2023 09:07:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 884C63858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679994453; bh=cCAjV5QpiwWeJcBZJcRxu6g/5dJAsf2pe1Nd7Fw9LKA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Av1Z1KN55x1ERgl1yODg7nTzbgOnIVt3zu4Dl4kGzKjWkBGiHlZRVI1IasOaZ84Yl X5hN1yQEpxtNcYxgLPqu/kNNJFZ8rLtyQhMiFTnzY/qR5PiTDQCfifvMpKRIwKECLc avugnjziypHyD3keHTfuFvESQyd1URkXwd2z7BwM= From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/108581] wrong assignment on two-rank array with deferred-length characters Date: Tue, 28 Mar 2023 09:07:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW 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: everconfirmed bug_status cf_reconfirmed_on cc Message-ID: In-Reply-To: References: 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=3D108581 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-03-28 CC| |pault at gcc dot gnu.org --- Comment #2 from Paul Thomas --- Dear Saito-san, Thank you for the report. Confirmed on 13.0.1. The fault persists even when the limits are changed (I thought that the zer= os might be the cause of the problem). Regards Paul For the record, the error occurs in creating the array descriptor for the transfer to the library write function: { integer(kind=3D8) D.4307; integer(kind=3D8) D.4308; integer(kind=3D8) D.4309; struct array01_character(kind=3D1) parm.12; integer(kind=3D8) D.4316; _F.a =3D _F.a; D.4307 =3D a.dim[0].lbound; D.4308 =3D a.dim[0].ubound; D.4309 =3D (integer(kind=3D8)) y; parm.12.span =3D NON_LVALUE_EXPR <_F.a>; parm.12.dtype =3D {.elem_len=3D(unsigned long) _F.a, .rank=3D= 1, .type=3D6}; D.4316 =3D a.dim[0].stride; parm.12.dim[0].lbound =3D 1; parm.12.dim[0].ubound =3D (1 - D.4307) + D.4308; parm.12.dim[0].stride =3D NON_LVALUE_EXPR ; parm.12.data =3D a.data + (sizetype) (((D.4307 - a.dim[0].lbo= und) * D.4316 + (D.4309 - a.dim[1].lbound) * a.dim[1].stride) * (integer(kind=3D8)) SAVE_EXPR ); parm.12.offset =3D -NON_LVALUE_EXPR ; _gfortran_transfer_array_write (&dt_parm.11, &parm.12, 1, _F.= a); } I suspect that SAVE_EXPR is returning zero so that the data pointe= r is independent of y. The first write statement scalarizes the operation and ma= kes use of the 'span' field of 'a', rather than D.4318.=