From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21401 invoked by alias); 29 Jan 2015 10:03:23 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 21290 invoked by uid 48); 29 Jan 2015 10:03:11 -0000 From: "bugs at stellardeath dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64854] New: No bound check for explicit-shape arrays Date: Thu, 29 Jan 2015 10:03:00 -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: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bugs at stellardeath dot org X-Bugzilla-Status: UNCONFIRMED 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 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg03366.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64854 Bug ID: 64854 Summary: No bound check for explicit-shape arrays Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: bugs at stellardeath dot org I assumed that the following would be catched by -fcheck=bounds, array "a" is passed as an explicit-shape array to subroutine "testsub" with the invalid bounds "n1", "n2": program test use m1 implicit none integer :: n1, n2 real :: a(1:10) ! Setup invalid indices: n1 = 1024*1024 n2 = 1024*1024*2 call testsub(a, n1, n2) contains subroutine testsub(a, n1, n2) integer :: n1, n2 real :: a(n1:n2) integer :: i do i = n1, n2 a(i) = 0 end do end subroutine end program But this happily produces a segfault. My gfortran version: #> gfortran-4.9 --version GNU Fortran (SUSE Linux) 4.9.0 Copyright (C) 2014 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING Kind regards, Lorenz