public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-07 20:53 ` janus at gcc dot gnu.org
  2010-10-07 21:07 ` janus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2010-10-07 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.10.07 20:53:21
                 CC|                            |janus at gcc dot gnu.org
            Summary|alloc_comp_scalar_1.f90:    |alloc_comp_scalar_1.f90:
                   |Valgrind  Invalid read of   |Valgrind  Invalid read of
                   |size 4                      |size 8
     Ever Confirmed|0                           |1

--- Comment #3 from janus at gcc dot gnu.org 2010-10-07 20:53:21 UTC ---
Confirmed at r165126.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
  2010-10-07 20:53 ` [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind Invalid read of size 8 janus at gcc dot gnu.org
@ 2010-10-07 21:07 ` janus at gcc dot gnu.org
  2010-10-24 10:04 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: janus at gcc dot gnu.org @ 2010-10-07 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from janus at gcc dot gnu.org 2010-10-07 21:07:07 UTC ---
It seems the "invalid read" is due to the call to PACK. It still appear when
commenting out lines 15 & 16, but not any more when commenting out 14, 15 & 16.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
  2010-10-07 20:53 ` [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind Invalid read of size 8 janus at gcc dot gnu.org
  2010-10-07 21:07 ` janus at gcc dot gnu.org
@ 2010-10-24 10:04 ` burnus at gcc dot gnu.org
  2010-10-24 19:10 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-24 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-24 10:04:19 UTC ---
Actually, it does not have anything to do with PACK but rather with the
assignment -- which implicitly also happens if one uses
  print *, pack(a2,[.true.])

The assignment works as follows:

a) Free the pointer target of a1(1:1)%entry
b) Pack: a1 = a2  ! struct a1 is OK, but a1%entry points to b1%entry
c) allocate(tmp), allocate(tmp%entry), memcopy(tmp%entry = a1%entry)
d) a1 = tmp  ! i.e. a1%entry now points to tmp%entry
e) free(tmp) ! but not free(tmp%entry)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-10-24 10:04 ` burnus at gcc dot gnu.org
@ 2010-10-24 19:10 ` burnus at gcc dot gnu.org
  2010-10-26  6:50 ` burnus at gcc dot gnu.org
  2010-10-26  6:52 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-24 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-24 19:10:10 UTC ---
The problem was that for copying the component, not the size of the element but
the size of the pointer was used.

Cf. http://gcc.gnu.org/ml/fortran/2010-10/msg00229.html for more details and
for a patch.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2010-10-24 19:10 ` burnus at gcc dot gnu.org
@ 2010-10-26  6:50 ` burnus at gcc dot gnu.org
  2010-10-26  6:52 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-26  6:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-26 06:49:47 UTC ---
Author: burnus
Date: Tue Oct 26 06:49:43 2010
New Revision: 165936

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165936
Log:
2010-10-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/45451
        * trans-stmt.c (gfc_trans_allocate): Do a deep-copy for SOURCE=.

        PR fortran/43018
        * trans-array.c (duplicate_allocatable): Use size of type and not
        the size of the pointer to the type.

2010-10-26  Tobias Burnus <burnus@net-b.de>

        PR fortran/45451
        * gfortran.dg/class_allocate_5.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/class_allocate_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind  Invalid read of size 8
       [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2010-10-26  6:50 ` burnus at gcc dot gnu.org
@ 2010-10-26  6:52 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-26  6:52 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-10-26 06:52:24 UTC ---
FIXED on the trunk (4.6).

As allocatable scalars have improved a lot in 4.6, thus I do not intent to
backport to 4.5. But feel free to do so, if you think otherwise - the patch is
trivial.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-26  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43018-4@http.gcc.gnu.org/bugzilla/>
2010-10-07 20:53 ` [Bug fortran/43018] alloc_comp_scalar_1.f90: Valgrind Invalid read of size 8 janus at gcc dot gnu.org
2010-10-07 21:07 ` janus at gcc dot gnu.org
2010-10-24 10:04 ` burnus at gcc dot gnu.org
2010-10-24 19:10 ` burnus at gcc dot gnu.org
2010-10-26  6:50 ` burnus at gcc dot gnu.org
2010-10-26  6:52 ` burnus at gcc dot gnu.org

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).