This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/64854] New: No bound check for explicit-shape arrays
- From: "bugs at stellardeath dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 29 Jan 2015 10:03:07 +0000
- Subject: [Bug fortran/64854] New: No bound check for explicit-shape arrays
- Auto-submitted: auto-generated
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