allen@radiative.com

Segmentation fault in FORTRAN WHERE statement

Discussion created by allen@radiative.com on Jun 2, 2011
Latest reply on Dec 22, 2011 by santosh.zanjurne

I'm using version 4.2.5.1of the FORTRAN compiler. I get a segmentation fault in the WHERE statement in the attached code. Reducing the size of the N array by just a few words allows it to run to completion. Compile with

openf95 -o go go.f90

Thanks,
Allen

program go real, allocatable :: n(:) allocate( n(3144000) ) call random_number( n ) call a ( size(n), n ) end program go subroutine a ( l, n ) integer, intent(in) :: l real, intent(in) :: n(l) integer, allocatable :: m(:) real :: k integer, parameter :: r = 1 integer :: ios allocate( m(size(n)), stat=ios ) m = r + 1 k = 0.5 where ( n .gt. k ) m = r + 2 end where end subroutine a

Outcomes