public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "b.w.barker at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/40850] double free in nested types with allocatable components
Date: Wed, 06 Jun 2012 20:20:00 -0000	[thread overview]
Message-ID: <bug-40850-4-FUx2kG5B2N@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-40850-4@http.gcc.gnu.org/bugzilla/>

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

Brent W. Barker <b.w.barker at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b.w.barker at gmail dot com

--- Comment #16 from Brent W. Barker <b.w.barker at gmail dot com> 2012-06-06 20:19:57 UTC ---
I found that the following nested deallocation program still fails in 4.6.3.
Sorry it's so long, I don't have time to think about how to shorten it right
now. It compiles and runs without error with ifort 12.1.4 20120410, and I
didn't try it with 4.7.

$ gfortran --version
GNU Fortran (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
...

$ uname -a
Linux hostname 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012
x86_64 x86_64 x86_64 GNU/Linux

$ gfortran testdealloc.F90
$ ./a.out

*** glibc detected *** ./a.out: double free or corruption (top):
0x0000000001edb0a0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7e626)[0x7fadbf3b1626]
./a.out[0x400fa7]
./a.out[0x401029]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fadbf35476d]
./a.out[0x400709]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:05 132394                            
/home/barker/sandbox/a.out
00601000-00602000 r--p 00001000 08:05 132394                            
/home/barker/sandbox/a.out
00602000-00603000 rw-p 00002000 08:05 132394                            
/home/barker/sandbox/a.out
01ed8000-01ef9000 rw-p 00000000 00:00 0                                  [heap]
7fadbebed000-7fadbec02000 r-xp 00000000 08:05 7340318                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fadbec02000-7fadbee01000 ---p 00015000 08:05 7340318                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fadbee01000-7fadbee02000 r--p 00014000 08:05 7340318                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fadbee02000-7fadbee03000 rw-p 00015000 08:05 7340318                   
/lib/x86_64-linux-gnu/libgcc_s.so.1
7fadbee03000-7fadbeefc000 r-xp 00000000 08:05 7340241                   
/lib/x86_64-linux-gnu/libm-2.15.so
7fadbeefc000-7fadbf0fb000 ---p 000f9000 08:05 7340241                   
/lib/x86_64-linux-gnu/libm-2.15.so
7fadbf0fb000-7fadbf0fc000 r--p 000f8000 08:05 7340241                   
/lib/x86_64-linux-gnu/libm-2.15.so
7fadbf0fc000-7fadbf0fd000 rw-p 000f9000 08:05 7340241                   
/lib/x86_64-linux-gnu/libm-2.15.so
7fadbf0fd000-7fadbf132000 r-xp 00000000 08:05 393626                    
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fadbf132000-7fadbf331000 ---p 00035000 08:05 393626                    
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fadbf331000-7fadbf332000 r--p 00034000 08:05 393626                    
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fadbf332000-7fadbf333000 rw-p 00035000 08:05 393626                    
/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7fadbf333000-7fadbf4e6000 r-xp 00000000 08:05 7340313                   
/lib/x86_64-linux-gnu/libc-2.15.so
7fadbf4e6000-7fadbf6e5000 ---p 001b3000 08:05 7340313                   
/lib/x86_64-linux-gnu/libc-2.15.so
7fadbf6e5000-7fadbf6e9000 r--p 001b2000 08:05 7340313                   
/lib/x86_64-linux-gnu/libc-2.15.so
7fadbf6e9000-7fadbf6eb000 rw-p 001b6000 08:05 7340313                   
/lib/x86_64-linux-gnu/libc-2.15.so
7fadbf6eb000-7fadbf6f0000 rw-p 00000000 00:00 0 
7fadbf6f0000-7fadbf804000 r-xp 00000000 08:05 393401                    
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fadbf804000-7fadbfa04000 ---p 00114000 08:05 393401                    
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fadbfa04000-7fadbfa05000 r--p 00114000 08:05 393401                    
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fadbfa05000-7fadbfa07000 rw-p 00115000 08:05 393401                    
/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7fadbfa07000-7fadbfa29000 r-xp 00000000 08:05 7340317                   
/lib/x86_64-linux-gnu/ld-2.15.so
7fadbfc04000-7fadbfc08000 rw-p 00000000 00:00 0 
7fadbfc26000-7fadbfc29000 rw-p 00000000 00:00 0 
7fadbfc29000-7fadbfc2a000 r--p 00022000 08:05 7340317                   
/lib/x86_64-linux-gnu/ld-2.15.so
7fadbfc2a000-7fadbfc2c000 rw-p 00023000 08:05 7340317                   
/lib/x86_64-linux-gnu/ld-2.15.so
7fff13969000-7fff1398b000 rw-p 00000000 00:00 0                         
[stack]
7fff139d5000-7fff139d6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                 
[vsyscall]
Aborted (core dumped)



module class_Foo
 implicit none

 type :: SubFoo
  integer :: num
 end type

 type :: Foo
  class(SubFoo), allocatable :: aSubFoo
 end type Foo

 type :: SuperFoo
  type(Foo), allocatable, dimension(:) :: foos
 end type

end module class_Foo

program testdealloc
 use class_Foo
 implicit none

 type(SuperFoo) :: mySuperFoo

 type(Foo), allocatable, dimension(:) :: myFoos

 type(SubFoo) :: mySubFoo

 mySubFoo=SubFoo(1)

 allocate(myFoos(10))

 allocate(myFoos(1)%aSubFoo, source=mySubFoo)

 mySuperFoo = SuperFoo(myFoos)

 deallocate(mySuperFoo%foos)

end program testdealloc


  parent reply	other threads:[~2012-06-06 20:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-40850-4@http.gcc.gnu.org/bugzilla/>
2010-12-28 22:56 ` dfranke at gcc dot gnu.org
2011-02-21  7:56 ` burnus at gcc dot gnu.org
2011-02-21 13:02 ` mikael at gcc dot gnu.org
2011-02-21 13:04 ` mikael at gcc dot gnu.org
2011-02-23 23:08 ` mikael at gcc dot gnu.org
2012-04-26 14:04 ` janus at gcc dot gnu.org
2012-06-06 20:20 ` b.w.barker at gmail dot com [this message]
2012-06-06 20:58 ` janus at gcc dot gnu.org
2012-06-09 22:49 ` b.w.barker at gmail dot com
2012-10-06 21:26 ` janus at gcc dot gnu.org
2009-07-24 19:35 [Bug fortran/40850] New: "double free or corruption" returning derived " mrestelli at gmail dot com
2009-12-06 18:15 ` [Bug fortran/40850] double free in nested " dfranke at gcc dot gnu dot org
2009-12-07 21:01 ` janus at gcc dot gnu dot org
2010-01-07 14:49 ` pault at gcc dot gnu dot org
2010-01-29 18:24 ` mrestelli at gmail dot com
2010-02-12 13:51 ` domob at gcc dot gnu dot org
2010-03-07 17:24 ` dominiq at lps dot ens dot fr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-40850-4-FUx2kG5B2N@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).