This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
$ cat a1.f90
integer x(1,1)
x(1,2) = 1
end
$ gfortran -fbounds-check a1.f90 -w && ./a.out
Fortran runtime error: Array reference out of bounds for array 'x', upper bound of dimension 2 exceeded (in file 'a1.f90', at line 2)
$ cat a1bis.f90
integer x(1,1)
x(1:2,1) = 1
end
$ gfortran -fbounds-check a1bis.f90 -w && ./a.out
Fortran runtime error: Array bound mismatch, upper bound of dimension 1 of array 'x' exceeded (in file 'a1bis.f90', at line 2)
$ cat a2.f
integer i
assign 800 to i
800 continue
read(*,i)
end
$ gfortran -fbounds-check a2.f -w && ./a.out
Fortran runtime error: Label assigned to variable 'i' is not a format label (in file 'a2.f', at line 4)
$ cat a3.f
integer i
assign 800 to i
goto i
800 format(A)
end
$ gfortran -fbounds-check a3.f -w && ./a.out
Fortran runtime error: Assigned label is not a target label (in file 'a3.f', at line 3)
$ cat a4.f
integer i
assign 800 to i
goto i, (200)
800 continue
200 continue
end
$ gfortran -fbounds-check a4.f -w && ./a.out
Fortran runtime error: Assigned label is not in the list (in file 'a4.f', at line 3)
$ cat a5.f90 program alloc_dummy
implicit none integer, allocatable :: a(:)
allocate(a(5)) print *, whatever(a)
contains
function whatever(x) integer, allocatable :: x(:) integer :: whatever(size(x)+1)
whatever = x
end function whatever
end program alloc_dummy
$ gfortran -fbounds-check a5.f90 -w && ./a.out
Fortran runtime error: Array bound mismatch, size mismatch for dimension 1 of array 'whatever' (in file 'a5.f90', at line 15)
Thanks, FX
Attachment:
bounds_check.ChangeLog
Description: Binary data
Attachment:
bounds_check.diff
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |