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

--- Comment #9 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to janus from comment #8)
> Reducing the test case slightly more:
> 
> 
> program ptr_alloc
> 
>    type :: t
>       class(*), allocatable :: val
>    end type
> 
>    type :: list
>       type(t), dimension(:), pointer :: ll
>    end type
> 
>    integer :: i
>    type(list) :: a
> 
>    allocate(a%ll(1:2))
>    do i = 1,2
>       allocate(a%ll(i)%val, source=i)
>    end do
> 
>    call rrr(a)
> 
> contains
>  
>    subroutine rrr(a)
>       type(list), intent(in) :: a
>       class(*), allocatable :: c
> 
>       allocate(c, source=a%ll(2)%val)
> 
>    end subroutine
> 
> end
> 
> 
> The bad stuff obviously happens in the allocate statement inside 'rrr'. The
> dump for this version is a bit more compact, but still rather cryptic.

Somewhat unexpectedly, replacing the allocate in 'rrr' with:
c=a%ll(2)%val

works just fine. This is an OK workaround and gives me time to fix the problem.

Cheers

Paul

Reply via email to