From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0BC7F398B85B; Tue, 9 Feb 2021 15:30:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0BC7F398B85B From: "andrew.burgess at embecosm dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99027] New: Incorrect ubound result Date: Tue, 09 Feb 2021 15:30:30 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: andrew.burgess at embecosm dot com 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 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 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: Tue, 09 Feb 2021 15:30:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99027 Bug ID: 99027 Summary: Incorrect ubound result Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: andrew.burgess at embecosm dot com Target Milestone: --- I believe I have run into a case where ubound is giving the wrong result. Given: program test integer, dimension (1:3,1:6) :: array print *, "ubound =3D ", ubound (array (1, 1:4)) end program test I see the output: ubound =3D 1 When I would have expected: ubound =3D 4 Due to array (1, 1:4) being a 4 element 1-dimensional array. I am seeing this behaviour in my default Fedora compiler: GNU Fortran (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2) But I also build current HEAD from git (26a3f288f18) and am still seeing th= is issue: GNU Fortran (GCC) 11.0.0 20210209 (experimental) Interestingly, if I change the test program to: program test integer, dimension (1:3,1:6) :: array print *, "ubound =3D ", ubound (array (1:2, 1:4)) end program test Then I do now see what I would expect for this case: ubound =3D 2 4=