From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28012 invoked by alias); 14 Aug 2013 17:06:29 -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 27988 invoked by uid 48); 14 Aug 2013 17:06:28 -0000 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58146] Array slice bounds checking Date: Wed, 14 Aug 2013 17:06:00 -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: 4.9.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: tkoenig at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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: 2013-08/txt/msg00767.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58146 --- Comment #5 from Mikael Morin --- (In reply to Mikael Morin from comment #4) > (In reply to Thomas Koenig from comment #0) > > neither does it do so with -fcheck=all at runtime: > > > There is no out of bound at run time because the scalarizer sets the loop > bounds according to the array providing the most information; in this case > the constant array of size 3, so that the loop has only 3 iterations. This variant should trigger an out of bound runtime error, but it doesn't either. program main implicit none integer :: n real, dimension(4) :: a n = 0 call random_number(a) if (any(a(n+1:n+4) > [1.0, 2.0, 3.0, 4.0, 5.0])) print *,"Hello!" end program main Technically a(n+1:n+4) is within the bounds, the out of bounds comes from the loop with a 5-sized array.