From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5DC643856DF0; Sat, 28 May 2022 18:04:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DC643856DF0 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/105759] is_contiguous(zero_size_array(2:0)) wrongly returns .true. Date: Sat, 28 May 2022 18:04:45 +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: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kargl 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: 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: Sat, 28 May 2022 18:04:45 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105759 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #0) > GCC and ifort both return T for the following code: >=20 > integer :: a(2) > print *, is_contiguous(a(2:1)) > end >=20 >=20 > However, I think that should be F / .false. as F2018 has: >=20 > 8.5.7 CONTIGUOUS attribute > ... > An object is contiguous if it is > ... > (7) a nonzero-sized array section (9.5.3) provided that > ... >=20 >=20 > Disclaimer: I might have missed something. >=20 >=20 > If it is a bug, then we probably need to fix both the simplify.cc > compile-time and libgfortran run-time check. I think that you may be wrongly interpreting what the standard says. (7) clearly does not apply to your code because a(2:1) is a zero-sized array section. What I think you're missing from 22-007.pdf, page 104, It is processor dependent whether any other object is contiguous. and a zero-sized entity falls under this statement. Then on page 94, we ha= ve An empty sequence forms a zero-sized array. As the sequence is empty, it can be neither contiguous nor discontiguous.=