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/56596] New: Invalid read of size 4 gfortran.dg/class_array_7.f03 Date: Mon, 11 Mar 2013 13:54:00 -0000 [thread overview] Message-ID: <bug-56596-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56596 Bug #: 56596 Summary: Invalid read of size 4 gfortran.dg/class_array_7.f03 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: dominiq@lps.ens.fr Running gfortran.dg/class_array_7.f03 under valgrind gives ==54979== Invalid read of size 4 ==54979== at 0x100001731: __realloc_MOD_assign (class_array_7.f03:25) ==54979== by 0x100001629: __realloc_MOD_reallocate (class_array_7.f03:33) ==54979== by 0x1000019D8: MAIN__ (class_array_7.f03:55) ==54979== by 0x100001B7D: main (class_array_7.f03:49) ==54979== Address 0x10044a408 is 0 bytes after a block of size 40 alloc'd ==54979== at 0x100013679: malloc (vg_replace_malloc.c:266) ==54979== by 0x1000017E0: MAIN__ (class_array_7.f03:53) ==54979== by 0x100001B7D: main (class_array_7.f03:49) ==54979== ==54979== ==54979== HEAP SUMMARY: ==54979== in use at exit: 88 bytes in 1 blocks ==54979== total heap usage: 25 allocs, 24 frees, 7,061 bytes allocated ==54979== ==54979== LEAK SUMMARY: ==54979== definitely lost: 0 bytes in 0 blocks ==54979== indirectly lost: 0 bytes in 0 blocks ==54979== possibly lost: 0 bytes in 0 blocks ==54979== still reachable: 0 bytes in 0 blocks ==54979== suppressed: 88 bytes in 1 blocks ==54979== ==54979== For counts of detected and suppressed errors, rerun with: -v ==54979== ERROR SUMMARY: 5 errors from 1 contexts (suppressed: 0 from 0) The test also aborts if it is compiled with -fsanitize=address. Reduced test module realloc implicit none type :: base_type integer :: i contains procedure :: assign generic :: assignment(=) => assign ! define generic assignment end type base_type type, extends(base_type) :: extended_type integer :: j end type extended_type contains elemental subroutine assign (a, b) class(base_type), intent(out) :: a class(base_type), intent(in) :: b a%i = b%i end subroutine assign subroutine reallocate (a) class(extended_type), dimension(:), allocatable :: tmp class(base_type), dimension(:), allocatable, intent(inout) :: a allocate (extended_type :: tmp (size (a))) ! how to alloc b with same type as a ? tmp = a ! polymorphic l.h.s. call move_alloc (from=tmp, to=a) end subroutine reallocate end module realloc program main use realloc implicit none class(base_type), dimension(:), allocatable :: a allocate (extended_type :: a(10)) call reallocate (a) end program main
next reply other threads:[~2013-03-11 13:54 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-03-11 13:54 dominiq at lps dot ens.fr [this message] 2013-03-13 14:18 ` [Bug fortran/56596] " janus at gcc dot gnu.org 2013-06-27 10:00 ` dominiq at lps dot ens.fr 2013-06-27 21:46 ` dominiq at lps dot ens.fr 2013-06-28 7:10 ` burnus at gcc dot gnu.org 2013-06-29 22:07 ` dominiq at lps dot ens.fr 2013-06-30 15:25 ` dominiq at lps dot ens.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-56596-4@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: linkBe 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).