From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 888FA3858D28; Sun, 13 Mar 2022 21:58:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 888FA3858D28 From: "a.shahmoradi at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104908] New: gfortran 11/trunk regression: incorrect Fortran out-of-bound runtime error. Date: Sun, 13 Mar 2022 21:58:51 +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.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: a.shahmoradi at gmail 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: Sun, 13 Mar 2022 21:58:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104908 Bug ID: 104908 Summary: gfortran 11/trunk regression: incorrect Fortran out-of-bound runtime error. Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: a.shahmoradi at gmail dot com Target Milestone: --- The following code appears to be standard-conforming, but gfortran throws a runtime error with the flag `-check=3Dbounds`, ``` program test type vec integer :: x(3) end type type(vec) :: v(2) call sub(v) contains subroutine sub (v) class(vec), intent(in) :: v(:) integer :: k, q(3) q =3D [ (v(1)%x(k), k =3D 1, 3) ] ! <-- fails here end subroutine end program ``` Here is the error message, ``` At line 19 of file /app/example.f90 Fortran runtime error: Index '3' of dimension 1 of array 'v%_data%x' above upper bound of 2 ``` This is a gfortran-11 regression since the code is functional with gfortran= -10 with the same compile flags. It can be tested here with different versions = of gfortran: https://godbolt.org/z/K6chcYE5e This issue was raised in a StackOverflow question: https://stackoverflow.com/questions/71441100/class-dummy-argument-for-array= -of-custom-types-stuck-on-fcheck-bounds I am only reporting it to the GNU Bugzilla.=