https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91077

--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to ygal klein from comment #4)
> The following code presents a difference (!) between gfortran 8.2 and
> gfortran 9.1:
> 
> program test
>   implicit none
>   integer, parameter :: length = 2
>   real(8), dimension(length) :: a, b
>   integer :: i
> 
>   type point
>      real(8) :: x
>   end type point
> 
>   type points
>      type(point), dimension(:), pointer :: np=>null()
>   end type points
> 
>   type stored
>      integer :: l
>      type(points), pointer :: nfpoint=>null()
>   end type stored
> 
>   type(stored), dimension(:), pointer :: std=>null()
> 
> 
>   allocate(std(1))
>   allocate(std(1)%nfpoint)
>   allocate(std(1)%nfpoint%np(length))
>   std(1)%nfpoint%np(1)%x = 0.3d0
>   std(1)%nfpoint%np(2)%x = 0.3555d0
> 
>   do i = 1, length
>      write(*, "('std(1)%nfpoint%np(',i1,')%x = ',1e22.14)") i,
> std(1)%nfpoint%np(i)%x
>   end do
>   do i = 1, length
>      write(*, "('std(1)%nfpoint%np(1:',i1,')%x = ',2e22.14)") i,
> std(1)%nfpoint%np(1:i)%x
>   end do
>   a = std(1)%nfpoint%np(1:2)%x
>   b = [std(1)%nfpoint%np(1)%x, std(1)%nfpoint%np(2)%x]
>   if (norm2(a - b) .gt. 1d-3) then
>      write(*,*) 'failure'
>   else
>      write(*, *) 'success'
>   end if
> end program test
> 
> 
> Running with gfortan-8.2 results with 'success' and running with
> gfortran-9.1 results with 'failure'.
> 
> Removing the integer variable 'l' from the type 'stored' makes both versions
> (8.2 and 9.1) end with 'success'
> 
> Thanks.

PS. The posted patch works with this guy too.

Thanks for posting the problem and staying in touch.

Regards

Paul

Reply via email to