[Patch, fortran] PR34640 - ICE when assigning item of a derived-component to a pointer
Dominique d'Humières
dominiq@lps.ens.fr
Mon Jul 10 13:51:00 GMT 2017
Dear Paul,
The new patch passes all my tests but gfortran.dg/pointer_array_7.f90 with -m32. The following instrumented test
module x
use iso_c_binding
implicit none
type foo
complex :: c
integer :: i
end type foo
contains
subroutine printit(c, a)
complex, pointer, dimension(:) :: c
integer :: i
integer(kind=8) :: a
a = transfer(c_loc(c(2)),a)
print *, a
end subroutine printit
end module x
program main
use x
use iso_c_binding
implicit none
type(foo), dimension(5), target :: a
integer :: i
complex, dimension(:), pointer :: pc
integer(kind=8) :: s1, s2, s3
a%i = 0
do i=1,5
a(i)%c = cmplx(i**2,i)
end do
pc => a%c
call printit(pc, s3)
s1 = transfer(c_loc(a(2)%c),s1)
print *, s1
! if (s1 /= s3) call abort
s2 = transfer(c_loc(pc(2)),s2)
print *, s2
if (s2 /= s3) call abort
end program main
gives at run time
140734725288716
140734725288716
140734725288716
with -m64, but
3220395052
-6820988759585893332
-6820989146132949972
Program aborted. Backtrace:
…
with -m32.
TIA
Dominique
More information about the Fortran
mailing list