http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46978
Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org Summary|[4.6 Regression] TRANSPOSE |[4.6 Regression] TRANSPOSE |corrupts structure and |with RESHAPE and ALLOCATE: |memory |Segfault --- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-16 21:31:43 UTC --- Further reduced test case. The ALLOCATE of A with a non-constant bound and a RESHAPE with a non-constant bound are crucial ingredients - as is the TRANSFER. (The purpose of "TWO" is to make the dump a tad more readable.) Works: 2010-09-09-r164046 Fails: 2010-09-28-r164677 Thus, a good candidate would be the TRANSFER rewriting patch for PR 45648. The program crashes with: *** glibc detected *** ./a.out: free(): invalid pointer: 0x0000000000604040 *** program elastic2 implicit none real, allocatable, dimension(:,:) :: coor real, allocatable, dimension(:) :: a integer :: nno nno = 3 allocate(a(2*nno)) call two() coor = transpose ( reshape ( a, (/2,nno/) ) ) contains subroutine two() allocate(coor(3,2)) coor = 99 a = 12 end subroutine end program elastic2