public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64854] New: No bound check for explicit-shape arrays
@ 2015-01-29 10:03 bugs at stellardeath dot org
  2015-01-29 10:59 ` [Bug fortran/64854] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bugs at stellardeath dot org @ 2015-01-29 10:03 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-29 13:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29 10:03 [Bug fortran/64854] New: No bound check for explicit-shape arrays bugs at stellardeath dot org
2015-01-29 10:59 ` [Bug fortran/64854] " dominiq at lps dot ens.fr
2015-01-29 20:17 ` anlauf at gmx dot de
2015-01-29 20:49 ` bugs at stellardeath dot org
2015-01-29 22:39 ` dominiq at lps dot ens.fr
2015-01-29 22:41 ` anlauf at gmx dot de
2015-01-30 12:54 ` bugs at stellardeath dot org
2015-08-29 13:53 ` dominiq at lps dot ens.fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).