-fbounds-check causes Segmentation fault
marco restelli
mrestelli@gmail.com
Sat Sep 9 01:10:00 GMT 2006
Hi,
the following code works when compiled with
gfortran test_sf.f90 -o test_sf
but results in Segmentation fault when compiled
with
gfortran -fbounds-check test_sf.f90 -o test_sf
The same code works when compiled with the Intel
compiler.
gfortran --version
GNU Fortran 95 (GCC) 4.1.1 (Gentoo 4.1.1)
Copyright (C) 2006 Free Software Foundation, Inc.
Thank you for any suggestion
Marco
subroutine external_sub(lhs,npoin,mmax,v)
implicit none
interface
function lhs(n,v)
real :: lhs(n)
integer, intent(in) :: n
real, intent(in) :: v(n)
end function lhs
end interface
integer, intent(in) :: npoin, mmax
real, intent(out) :: v(npoin,mmax)
v(:,1) = 1.0
v(:,2) = lhs(npoin,v(:,1))
end subroutine external_sub
module mod_si
implicit none
public :: &
si_lhs
private
contains
function si_lhs(npoin,p)
real :: si_lhs(npoin)
integer, intent(in) :: npoin
real, intent(in) :: p(npoin)
write(0,*) 'begin si_lhs'
si_lhs = 2.0*p
write(0,*) 'end si_lhs'
end function si_lhs
end module mod_si
program e_si
use mod_si, only: &
si_lhs
implicit none
integer, parameter :: ik=300
integer :: npoin
real, dimension(:,:), allocatable :: kr
interface
subroutine external_sub(lhs,npoin,mmax,v)
interface
function lhs(n,v)
real :: lhs(n)
integer, intent(in) :: n
real, intent(in) :: v(n)
end function lhs
end interface
integer, intent(in) :: npoin, mmax
real, intent(out) :: v(npoin,mmax)
end subroutine external_sub
end interface
npoin = 6561
allocate(kr(npoin,ik))
call external_sub(si_lhs,npoin,ik,kr)
end program e_si
More information about the Fortran
mailing list