public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/56008] [F03] wrong code with lhs-realloc on assignment with derived types having allocatable components
Date: Sun, 20 Jan 2013 13:35:00 -0000	[thread overview]
Message-ID: <bug-56008-4-VukZYpx9nG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56008-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-01-20 13:34:52 UTC ---
> Created attachment 29221 [details]
> Fix for this PR and PR 47517

I confirm for this PR. However while the original code of PR 47517 executes
without error it has a huge memory leak:

==98070== HEAP SUMMARY:
==98070==     in use at exit: 146,401,340 bytes in 2,700,054 blocks
==98070==   total heap usage: 2,900,145 allocs, 200,091 frees, 170,502,858
bytes allocated
==98070== 
==98070== 12 bytes in 1 blocks are definitely lost in loss record 1 of 42
==98070==    at 0x100019679: malloc (vg_replace_malloc.c:266)
==98070==    by 0x100000EBB: MAIN__ (in ./a.out)
==98070==    by 0x100007BC9: main (in ./a.out)
...

==98070== 
==98070== 102,798,972 (71,999,280 direct, 30,799,692 indirect) bytes in 299,997
blocks are definitely lost in loss record 42 of 42
==98070==    at 0x100019679: malloc (vg_replace_malloc.c:266)
==98070==    by 0x1000072A7: MAIN__ (in ./a.out)
==98070==    by 0x100007BC9: main (in ./a.out)
==98070== 
==98070== LEAK SUMMARY:
==98070==    definitely lost: 105,601,152 bytes in 500,046 blocks
==98070==    indirectly lost: 40,800,100 bytes in 2,200,007 blocks
==98070==      possibly lost: 0 bytes in 0 blocks
==98070==    still reachable: 0 bytes in 0 blocks
==98070==         suppressed: 88 bytes in 1 blocks
==98070== 
==98070== For counts of detected and suppressed errors, rerun with: -v
==98070== ERROR SUMMARY: 34 errors from 34 contexts (suppressed: 0 from 0)

(loop reduded to 100000).

The test in PR 47517 comment #1 still fails at runtime:

 1>            1                    0
 2>            1                    0           1

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Compiling it with  -fsanitize=address gives

==237== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103be06b0
at pc 0x100000b75 bp 0x7fff5fbfd3a0 sp 0x7fff5fbfd398
READ of size 8 at 0x000103be06b0 thread T0


  parent reply	other threads:[~2013-01-20 13:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 19:37 [Bug fortran/56008] New: [F03] lhs-allocation invoking the array-constructor on DDTs causes memory error stefan.mauerberger at gmail dot com
2013-01-16 19:38 ` [Bug fortran/56008] " stefan.mauerberger at gmail dot com
2013-01-16 19:39 ` stefan.mauerberger at gmail dot com
2013-01-16 22:51 ` [Bug fortran/56008] [F03] wrong code with lhs-realloc on assignment with derived types having allocatable components burnus at gcc dot gnu.org
2013-01-19 15:55 ` pault at gcc dot gnu.org
2013-01-20 13:35 ` dominiq at lps dot ens.fr [this message]
2013-01-21 19:30 ` pault at gcc dot gnu.org
2013-01-22 19:08 ` stefan.mauerberger at gmail dot com
2013-02-04 22:33 ` pault at gcc dot gnu.org
2013-02-04 22:36 ` pault at gcc dot gnu.org
2013-02-10 18:35 ` stefan.mauerberger at gmail dot com

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-56008-4-VukZYpx9nG@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).