From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 359813858400; Wed, 10 Nov 2021 16:31:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 359813858400 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/102043] Wrong array types used for negative stride accesses Date: Wed, 10 Nov 2021 16:31:10 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael 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: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2021 16:31:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102043 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #8 from Mikael Morin --- It comes from gfc_conv_expr_descriptor: /* Point the data pointer at the 1st element in the section. */ gfc_get_dataptr_offset (&loop.pre, parm, desc, base, subref_array_target, expr); where base has been calculated as the index of the first element. I=E2=80=99ve tried doing a mere "if (forward) start else end" in the calcul= ation of base, but then I needed to add an offset (i.e. array index offset) to vector subscript accesses, and then a delta was missing (i.e. loop index offset) as the descriptor is one-based, but I don=E2=80=99t know how to fix the latter= without impacting all the vector subscript handling which seems to rely on quite a = few assumptions (no delta, no offset, zero-based loop?, forward loop?).=