[Bug fortran/40796] New: *** glibc detected *** double free or corruption (fasttop) with derived types with allocatable components
mrestelli at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Jul 18 10:50:00 GMT 2009
The attached code produces an error at runtime:
System:
Linux 2.6.27-gentoo-r8 x86_64 AMD Turion(tm) 64 Mobile Technology ML-32
AuthenticAMD GNU/Linux
$ gfortran bug.f90 -o bug
$ ./bug
*** glibc detected *** ./bug: double free or corruption (fasttop):
0x0000000000603fb0 ***
======= Backtrace: =========
/lib/libc.so.6[0x7fc237a7f468]
/lib/libc.so.6(cfree+0x76)[0x7fc237a80fa6]
./bug[0x40124f]
./bug[0x40129f]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7fc237a2a5c6]
./bug[0x4006c9]
======= Memory map: ========
00400000-00402000 r-xp 00000000 03:06 382295
/home/marco/CODICI/repository/LDG-H/tags/LDGH-gfortranbug/bug/bug
00601000-00602000 r--p 00001000 03:06 382295
/home/marco/CODICI/repository/LDG-H/tags/LDGH-gfortranbug/bug/bug
00602000-00603000 rw-p 00002000 03:06 382295
/home/marco/CODICI/repository/LDG-H/tags/LDGH-gfortranbug/bug/bug
00603000-00624000 rw-p 00603000 00:00 0 [heap]
7fc230000000-7fc230021000 rw-p 7fc230000000 00:00 0
7fc230021000-7fc234000000 ---p 7fc230021000 00:00 0
7fc237a0c000-7fc237b57000 r-xp 00000000 03:06 5867248
/lib64/libc-2.9.so
7fc237b57000-7fc237d57000 ---p 0014b000 03:06 5867248
/lib64/libc-2.9.so
7fc237d57000-7fc237d5b000 r--p 0014b000 03:06 5867248
/lib64/libc-2.9.so
7fc237d5b000-7fc237d5c000 rw-p 0014f000 03:06 5867248
/lib64/libc-2.9.so
7fc237d5c000-7fc237d61000 rw-p 7fc237d5c000 00:00 0
7fc237d61000-7fc237d77000 r-xp 00000000 03:06 1525564
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgcc_s.so.1
7fc237d77000-7fc237f76000 ---p 00016000 03:06 1525564
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgcc_s.so.1
7fc237f76000-7fc237f77000 r--p 00015000 03:06 1525564
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgcc_s.so.1
7fc237f77000-7fc237f78000 rw-p 00016000 03:06 1525564
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgcc_s.so.1
7fc237f78000-7fc237ffa000 r-xp 00000000 03:06 5966534
/lib64/libm-2.9.so
7fc237ffa000-7fc2381f9000 ---p 00082000 03:06 5966534
/lib64/libm-2.9.so
7fc2381f9000-7fc2381fa000 r--p 00081000 03:06 5966534
/lib64/libm-2.9.so
7fc2381fa000-7fc2381fb000 rw-p 00082000 03:06 5966534
/lib64/libm-2.9.so
7fc2381fb000-7fc2382e0000 r-xp 00000000 03:06 1525566
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgfortran.so.3.0.0
7fc2382e0000-7fc2384e0000 ---p 000e5000 03:06 1525566
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgfortran.so.3.0.0
7fc2384e0000-7fc2384e1000 r--p 000e5000 03:06 1525566
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgfortran.so.3.0.0
7fc2384e1000-7fc2384e2000 rw-p 000e6000 03:06 1525566
/home/marco/PROGI/bin-pack/gcc-trunk/lib64/libgfortran.so.3.0.0
7fc2384e2000-7fc2384e3000 rw-p 7fc2384e2000 00:00 0
7fc2384e3000-7fc238500000 r-xp 00000000 03:06 5867285
/lib64/ld-2.9.so
7fc2386d4000-7fc2386d7000 rw-p 7fc2386d4000 00:00 0
7fc2386fd000-7fc2386ff000 rw-p 7fc2386fd000 00:00 0
7fc2386ff000-7fc238700000 r--p 0001c000 03:06 5867285
/lib64/ld-2.9.so
7fc238700000-7fc238701000 rw-p 0001d000 03:06 5867285
/lib64/ld-2.9.so
7fff406eb000-7fff40700000 rw-p 7ffffffea000 00:00 0
[stack]
7fff407fe000-7fff407ff000 r-xp 7fff407fe000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
Aborted
module mod_all
implicit none
public :: t2, init, fun
private
type t1
integer, allocatable :: x(:)
end type t1
type t2
type(t1), allocatable :: y(:)
end type t2
contains
pure function init() result(p)
type(t2) :: p
allocate(p%y(1))
allocate(p%y(1)%x(1))
p%y(1)%x(1) = 0
end function init
pure function fun(m) result(q)
type(t1), intent(in) :: m
type(t2) :: q
end function fun
end module mod_all
program main
use mod_all, only: t2, init, fun
implicit none
type(t2) :: q, p
p = init()
q = fun(p%y(1))
end program main
--
Summary: *** glibc detected *** double free or corruption
(fasttop) with derived types with allocatable components
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mrestelli at gmail dot com
GCC build triplet: Configured with: .configure --enable-languages=c,fortran
--enabl
GCC host triplet: gcc version 4.5.0 20090717 (experimental) (GCC)
GCC target triplet: Target: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40796
More information about the Gcc-bugs
mailing list