Program crash for array copy with ifort

Posted by Stefano Borini on Stack Overflow See other posts from Stack Overflow or by Stefano Borini
Published on 2012-08-28T21:07:13Z Indexed on 2012/08/28 21:38 UTC
Read the original article Hit count: 184

Filed under:
|
|

This program crashes with Illegal instruction: 4 on MacOSX Lion and ifort (IFORT) 12.1.0 20111011

program foo
      real, pointer :: a(:,:), b(:,:)
      allocate(a(5400, 5400))
      allocate(b(5400, 3600))
      a=1.0
      b(:, 1:3600) = a(:, 1:3600)

      print *, a
      print *, b

      deallocate(a)
      deallocate(b)

end program 

The same program works with gfortran. I don't see any problem. Any ideas ? Unrolling the copy and performing the explicit loop over the columns works in both compilers.

Note that with allocatable instead of pointer I have no problems.

The behavior is the same if the statement is either inside a module or not.

I confirm the same behavior on Linux using ifort (IFORT) 12.1.3 20120130.

© Stack Overflow or respective owner

Related posts about fortran

Related posts about fortran95