------- Comment #2 from dominiq at lps dot ens dot fr  2008-07-07 18:37 -------
I don't see that on ppc/intel Darwin9, but the following modified code gives at
run time:

PROGRAM repro
  IMPLICIT NONE
  REAL(KIND=8), ALLOCATABLE :: a2(:,:), a(:,:)
  INTEGER(KIND=4) :: i, m, n

  m = 4
  n = 3
  ALLOCATE(a(m,n))
  a = reshape((/(i,i=1,m*n)/),(/m,n/))

  n = n - 1
  ALLOCATE(a2(m,n))

  ! this is the problematic assignment: is this legal??
  a2 = a
  print *, a2
  print *, shape(a), shape(a2)
  deallocate(a2)

END PROGRAM repro
[karma] f90/bug% gfc pr36751_db.f90
[karma] f90/bug% a.out 
  1.00000000000000000        2.0000000000000000        3.0000000000000000      
 4.0000000000000000        5.0000000000000000        6.0000000000000000       
7.0000000000000000        8.0000000000000000     
           4           3           4           2
a.out(39419) malloc: *** error for object 0x2006b0: incorrect checksum for
freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
a.out(39419) malloc: *** error for object 0x200670: incorrect checksum for
freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

I am not sure the code is valid.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36751

Reply via email to