[Bug fortran/35810] [TR 15581 / F2003] Automatic reallocation on assignment to allocatable variables
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Oct 28 17:39:00 GMT 2008
------- Comment #2 from burnus at gcc dot gnu dot org 2008-10-28 17:37 -------
Segfault with return values of allocatable functions.
A code which does not work is the following TR15581-conform program.
It seqfaults (SIGABRT) and valgrind shows errors of the kind:
==12853== Invalid write of size 4
==12853== at 0x400966: MAIN__ (aa.f90:7)
==12853== Address 0x58e7b4c is 0 bytes after a block of size 4 alloc'd
==12853== at 0x4C256AE: malloc (in
/usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so)
==12853== by 0x4008A4: MAIN__ (aa.f90:4)
Test case:
implicit none
integer,allocatable :: j(:)
integer :: i
allocate(j(1))
do i = 1,200000
! deallocate(j)
j = alloc()
end do
contains
function alloc()
integer, allocatable :: alloc(:)
allocate(alloc(10000))
end function
end
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|enhancement |normal
Keywords| |wrong-code
Summary|[F2003] Automatic |[TR 15581 / F2003] Automatic
|reallocation on assignment |reallocation on assignment
|to allocatable variables |to allocatable variables
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35810
More information about the Gcc-bugs
mailing list