From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31780 invoked by alias); 30 Aug 2010 12:13:27 -0000 Received: (qmail 31530 invoked by uid 48); 30 Aug 2010 12:12:12 -0000 Date: Mon, 30 Aug 2010 12:13:00 -0000 Message-ID: <20100830121212.31529.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/45451] [OOP] Inconsistent status of ALLOCATABLE components inside CLASS variables. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sfilippone at uniroma2 dot it" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg02413.txt.bz2 ------- Comment #2 from sfilippone at uniroma2 dot it 2010-08-30 12:12 ------- (In reply to comment #0) > Hello, > After a lot (a LOT) of work, I've come up with this test case. The test case > *appears* to run fine, but valgrind shows something is amiss, and in the full > application (much more complex) there follow multiple segfaults. I did not find > (so far) a way to have a test case both small and exibiting the error out of > valgrind, hope you'll pardon me. > The error: the ALLOCATABLE components of the ATX%A variable are detected as > ALLOCATED, and seemingly are printed OK, but VALGRIND says they were already > freed. > > Should be more careful before talking: the output is visibly wrong. > [sfilippo@donald bug23]$ ./bug23 > New version > Allocation status: T T T > 0 0 4 5 > 0 0 2 3 0 0 > 0 0 0 0 0 0 > 0.0000000000000000 1.0000000000000000 2.0000000000000000 > 3.0000000000000000 0.0000000000000000 0.0000000000000000 > 0.0000000000000000 0.0000000000000000 0.0000000000000000 > 0.0000000000000000 0.0000000000000000 0.0000000000000000 > [sfilippo@donald bug23]$ valgrind ./bug23 > ==6940== Memcheck, a memory error detector > ==6940== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. > ==6940== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info > ==6940== Command: ./bug23 > ==6940== > New version > Allocation status: T T T > ==6940== Invalid read of size 4 > ==6940== at 0x4CC19B8: extract_int (write.c:450) > ==6940== by 0x4CC27B1: write_integer (write.c:1260) > ==6940== by 0x4CC5BDE: _gfortrani_list_formatted_write (write.c:1552) > ==6940== by 0x4CBACA7: _gfortran_transfer_array (transfer.c:2000) > ==6940== by 0x401834: MAIN__ (bug23.f03:308) > ==6940== by 0x40197A: main (bug23.f03:284) > ==6940== Address 0x5141450 is 0 bytes inside a block of size 16 free'd > ==6940== at 0x4A04D72: free (vg_replace_malloc.c:325) > ==6940== by 0x4CCB5A8: _gfortran_move_alloc (move_alloc.c:41) > ==6940== by 0x400B90: __psb_d_csr_mat_mod_MOD_psb_d_mv_csr_from_fmt > (bug23.f03:238) > ==6940== by 0x401449: __psb_d_mat_mod_MOD_psb_d_mv_from (bug23.f03:277) > ==6940== by 0x4016C6: MAIN__ (bug23.f03:302) > ==6940== by 0x40197A: main (bug23.f03:284) > ==6940== > 1 3 4 5 > 1 1 2 3 0 0 > 0 0 0 0 0 0 > ==6940== Invalid read of size 8 > ==6940== at 0x4CC3795: write_float (write_float.def:1050) > ==6940== by 0x4CC508C: _gfortrani_write_real (write.c:1470) > ==6940== by 0x4CC5BAE: _gfortrani_list_formatted_write (write.c:1561) > ==6940== by 0x4CBACA7: _gfortran_transfer_array (transfer.c:2000) > ==6940== by 0x401904: MAIN__ (bug23.f03:310) > ==6940== by 0x40197A: main (bug23.f03:284) > ==6940== Address 0x5141510 is 0 bytes inside a block of size 96 free'd > ==6940== at 0x4A04D72: free (vg_replace_malloc.c:325) > ==6940== by 0x4CCB5A8: _gfortran_move_alloc (move_alloc.c:41) > ==6940== by 0x400BDC: __psb_d_csr_mat_mod_MOD_psb_d_mv_csr_from_fmt > (bug23.f03:240) > ==6940== by 0x401449: __psb_d_mat_mod_MOD_psb_d_mv_from (bug23.f03:277) > ==6940== by 0x4016C6: MAIN__ (bug23.f03:302) > ==6940== by 0x40197A: main (bug23.f03:284) > ==6940== > 1.0000000000000000 1.0000000000000000 2.0000000000000000 > 3.0000000000000000 0.0000000000000000 0.0000000000000000 > 0.0000000000000000 0.0000000000000000 0.0000000000000000 > 0.0000000000000000 0.0000000000000000 0.0000000000000000 > ==6940== > ==6940== HEAP SUMMARY: > ==6940== in use at exit: 0 bytes in 0 blocks > ==6940== total heap usage: 33 allocs, 33 frees, 4,938 bytes allocated > ==6940== > ==6940== All heap blocks were freed -- no leaks are possible > ==6940== > ==6940== For counts of detected and suppressed errors, rerun with: -v > ==6940== ERROR SUMMARY: 28 errors from 2 contexts (suppressed: 6 from 6) > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45451