This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/56008] [F03] wrong code with lhs-realloc on assignment with derived types having allocatable components


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]