https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80988
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Simple test case: $ cat swim.f90 program main implicit none integer :: i,j integer, dimension(3,3) :: a a = reshape([(((i*10+j),i=1,3),j=1,3)], shape(a)) print *,(a(i,i),i=1,3) end program main $ gfortran swim.f90 && ./a.out 11 22 33 $ gfortran -O swim.f90 && ./a.out 0 -188758720 32767 $