[Bug fortran/31320] Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90

dfranke at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jul 5 14:31:00 GMT 2007



------- Comment #3 from dfranke at gcc dot gnu dot org  2007-07-05 14:31 -------
Reduced testcase:

$> cat pr31320.f90
  type :: a
    integer, allocatable :: i(:)
  end type a
  type(a) :: x, y

  x = a ((/1, 2, 3, 4/))
  y = x
end

$> gfortran-svn -g -Wall pr31320.f90
$> valgrind --tool=memcheck --leak-check=full --show-reachable=yes a.out
[...]
==3173== Invalid read of size 1
==3173==    at 0x4022CC1: memcpy (mc_replace_strmem.c:406)
==3173==    by 0x80488AE: MAIN__ (alloc_comp_assign_2e.f90:8)
==3173==    by 0x8048938: main (fmain.c:22)
==3173==  Address 0x422C5C3 is 3 bytes after a block of size 16 alloc'd
==3173==    at 0x40213D0: malloc (vg_replace_malloc.c:149)
==3173==    by 0x8048710: MAIN__ (alloc_comp_assign_2e.f90:7)
==3173==    by 0x8048938: main (fmain.c:22)
[...]

In addition, while reducing this, I saw different kinds of other errors, most
notably unnecessary free's and leaking memory.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-05 14:31:03
               date|                            |


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



More information about the Gcc-bugs mailing list