[Bug fortran/110012] [PDT] ICE involving parametrized polymorphic variable
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Dec 7 23:11:47 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110012
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 63012
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63012&action=edit
Fix for this PR
The attached, which needs some tidying up, regtests OK and allows the following
to compile and run:
module pde_class
type, abstract :: pde(npde)
integer,len :: npde
end type
end module
module navier_stokes_type
use pde_class
type, extends(pde) :: navier_stokes
integer, allocatable :: data_(:)
end type
contains
subroutine alloc_navier_stokes(p , n)
class(pde(:)), allocatable :: p
allocate(navier_stokes(npde=3) :: p)
select type (p)
type is (navier_stokes(*))
allocate (p%data_, source = [1,2,3,4])
end select
end subroutine
end module
module mfe_disc_type
use pde_class
type :: foo
class(pde(:)), allocatable :: p
end type
end module
program test
call navier_stokes_test
call mfe_disc_test
contains
subroutine navier_stokes_test
use navier_stokes_type
class (pde(:)), allocatable :: x
call alloc_navier_stokes (x, 4)
select type (x)
type is (navier_stokes(*))
if (any (x%data_ /= [1,2,3,4])) stop 1
end select
end subroutine
subroutine mfe_disc_test
use navier_stokes_type
use mfe_disc_type
type (foo), allocatable :: x
end subroutine
end program
More information about the Gcc-bugs
mailing list