I've got some test code here that is not acting as I would suspect. I'm using the gfortran compiler.
program test
implicit none
integer, allocatable, dimension(:) :: a
integer, allocatable, dimension(:) :: b
allocate(a(2))
allocate(b(4))
a = 1
b = 2
write(*,*) a
write(*,*) ' '
write(*,*) b
write(*,*) ' '
write(*,*) 'a size before', size(a)
a = b
a = 1
write(*,*) a
write(*,*) ' '
write(*,*) b
write(*,*) ' '
write(*,*) 'a size after', size(a)
end program test
And I get the following output.
1 1
2 2 2 2
a size before 2
1 1 1 1
2 2 2 2
a size after 4
Why do I not get an error when assigning arrays of different dimensions? Why is the size of a changed?
gfortranversion 4.8.4 (except that "a size after" is 8, not 4). I have tried to use-fcheck=bounds, but even that didn't work. Looks like a compiler bug to me.