2 Replies Latest reply on Dec 22, 2011 10:16 AM by santosh.zanjurne

    Segmentation fault in FORTRAN WHERE statement

    allen@radiative.com

      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