Simple problem on array indices

Hom Nath Gharti hng.email@gmail.com
Thu Jan 9 12:14:00 GMT 2014


Dear all,

While I was testing a simple program:
program test
  implicit none
  integer :: inds(4),icount(3)

  inds = (/ 1, 2, 2, 3 /)
  icount = 0

  icount(inds) = icount(inds) + 1
  print*, icount
end program test

I got the following result with gfortran 4.8.2:

1     1     1

whereas with Intel fortran and PGI fortran compiler:

1     2     1

I was wondering whether there is anything wrong in the program.

Best,
Hom Nath



More information about the Fortran mailing list