https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84931
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|UNCONFIRMED |NEW Last reconfirmed| |2018-03-18 Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- The following code does the correct thing with an integer array 'y'. program test implicit none integer, parameter :: n = 65536 integer, dimension(n) :: y integer*4 :: i y = (/ (1, i=1, n) /) if (y(2) /= 1) stop 1 end program test The expansion of the array constructor is implemented by creating a temporary array and filling it with '1'. The temporary array is then copied into 'y'. This however does sideways program test implicit none integer, parameter :: n = 65536 real, dimension(n) :: y integer*4 :: i y = (/ (1, i=1, n) /) if (y(2) /= 1) stop 1 end program test A temporary array is created, but only the first element of the temporary array is initialized to 1. The temporary array is then copied into 'y', except the temporary array has not assigned values for tmp(2:65536). Tree dumps are here https://gcc.gnu.org/ml/fortran/2018-03/msg00096.html Problem found on Stack Overflow https://stackoverflow.com/questions/49330816/strange-initialization-behavior-for-an-array-constructor-with-implied-do-in-gfor