A line in my code assigns an array to an unallocated array. I thought it was a bug but to my surprise it works just fine.
program test
implicit none
real, allocatable :: x(:,:)
real :: y(2,2)
y = 1.
x = y
print*, x
end program test
How does this work in terms of memory? The =
operator here just allocates and assigns at the same time? Why is this possible and why is the compiler not complaining? I am using gfortran 5.4.0.