Simple problem on array indices
Janus Weil
janus@gcc.gnu.org
Thu Jan 9 12:36:00 GMT 2014
Dear Hom Nath,
> 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
I can confirm this result with gfortran 4.4, 4.6, 4.7 and 4.8. However ...
> whereas with Intel fortran and PGI fortran compiler:
>
> 1 2 1
... this matches what I get with a current gfortran trunk build.
> I was wondering whether there is anything wrong in the program.
Most probably the behavior you see is a bug in gfortran, but
apparently it has been fixed on trunk already.
Cheers,
Janus
More information about the Fortran
mailing list