This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ping, Patch 2/2, v3, Fortran, pr60322 a.o.] [OOP] Incorrect bounds on polymorphic dummy array
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: vehre at gmx dot de
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, paul dot richard dot thomas at gmail dot com
- Date: Sun, 22 Mar 2015 14:55:40 +0100
- Subject: Re: [Ping, Patch 2/2, v3, Fortran, pr60322 a.o.] [OOP] Incorrect bounds on polymorphic dummy array
- Authentication-results: sourceware.org; auth=none
Dear Andre,
If I am not mistaken, this patch make the following test (pr57305, second attachment):
subroutine add_element_poly(a,e)
use iso_c_binding
class(*),allocatable,intent(inout),target :: a(:)
class(*),intent(in),target :: e
class(*),allocatable,target :: tmp(:)
type(c_ptr) :: dummy
interface
function memcpy(dest,src,n) bind(C,name="memcpy") result(res)
import
type(c_ptr) :: res
integer(c_intptr_t),value :: dest
integer(c_intptr_t),value :: src
integer(c_size_t),value :: n
end function
end interface
if (.not.allocated(a)) then
allocate(a(1), source=e)
else
allocate(tmp(size(a)),source=a)
deallocate(a)
allocate(a(size(tmp)+1),mold=e)
dummy = memcpy(loc(a(1)),loc(tmp),sizeof(tmp))
dummy = memcpy(loc(a(size(tmp)+1)),loc(e),sizeof(e))
end if
end subroutine
to give an ICE (a regression):
pr57305_1.f90:24:0:
dummy = memcpy(loc(a(1)),loc(tmp),sizeof(tmp))
1
internal compiler error: Segmentation fault: 11
The ICE is caused by sizeof(tmp).
TIA
Dominique