[Bug fortran/56596] Invalid read of size 4 gfortran.dg/class_array_7.f03

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 13 14:18:00 GMT 2013


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |janus at gcc dot gnu.org

--- Comment #1 from janus at gcc dot gnu.org 2013-03-13 14:17:40 UTC ---
Reduced test case:


program main
  implicit none

  type :: base_type
    integer :: i
  end type

  type, extends(base_type) :: extended_type
    integer :: j
  end type

  class(base_type), dimension(:), allocatable :: a
  type(extended_type), dimension(1:2) :: tmp

  allocate (extended_type :: a(2))

  tmp%i=a%i
end


I think the problem is in the allocate statement:

a._data.data = (void * restrict) __builtin_malloc (8);

The allocation size seems to be independent of whether one allocates with
"base_type" or "extended type".



More information about the Gcc-bugs mailing list