This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/60542] [4.9 Regression] realloc_on_assign_5.f03 aborts
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 15 Mar 2014 23:52:31 +0000
- Subject: [Bug fortran/60542] [4.9 Regression] realloc_on_assign_5.f03 aborts
- Auto-submitted: auto-generated
- References: <bug-60542-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60542
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here's what valgrind has to say:
ig25@linux-fd1f:~/Krempel/Where> cat r.f90
! { dg-do run }
! Test the fix for PR47523 in which concatenations did not work
! correctly with assignments to deferred character length scalars.
!
! Contributed by Thomas Koenig <tkoenig@gcc.gnu.org>
!
program main
implicit none
character(:), allocatable :: a, b
a = 'a'
if (a .ne. 'a') call abort
a = a // 'x'
if (a .ne. 'ax') call abort
if (len (a) .ne. 2) call abort
a = (a(2:2))
print *,a
if (a .ne. 'x') call abort
if (len (a) .ne. 1) call abort
end program main
ig25@linux-fd1f:~/Krempel/Where> gfortran -g r.f90
ig25@linux-fd1f:~/Krempel/Where> valgrind ./a.out
==27652== Memcheck, a memory error detector
==27652== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==27652== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==27652== Command: ./a.out
==27652==
==27652== Invalid read of size 1
==27652== at 0x4C2BD60: memcpy@GLIBC_2.2.5 (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27652== by 0x400DBE: MAIN__ (r.f90:15)
==27652== by 0x400EDE: main (r.f90:19)
==27652== Address 0x5c56521 is 0 bytes after a block of size 1 alloc'd
==27652== at 0x4C29B7E: realloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==27652== by 0x400D7A: MAIN__ (r.f90:15)
==27652== by 0x400EDE: main (r.f90:19)
==27652==
Program aborted. Backtrace:
#0 0x4E4B417
#1 0x4E4CB12
#2 0x4F1D208
#3 0x400E87 in MAIN__ at r.f90:17 (discriminator 1)
==27652==
==27652== HEAP SUMMARY:
==27652== in use at exit: 3,700 bytes in 18 blocks
==27652== total heap usage: 25 allocs, 7 frees, 11,845 bytes allocated
==27652==
==27652== LEAK SUMMARY:
==27652== definitely lost: 0 bytes in 0 blocks
==27652== indirectly lost: 0 bytes in 0 blocks
==27652== possibly lost: 0 bytes in 0 blocks
==27652== still reachable: 3,700 bytes in 18 blocks
==27652== suppressed: 0 bytes in 0 blocks
==27652== Rerun with --leak-check=full to see details of leaked memory
==27652==
==27652== For counts of detected and suppressed errors, rerun with: -v
==27652== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
Abgebrochen