I wanted to hear about other users and devs experience on the status of polymorphism with PGF-18.x.
During my current code development I have found several ICEs and PGF runtime segfaults associated to using routines with multiple CLASS declarations. This is inside a somewhat involved OO fortran code, but to give an example of what the offending code looks like:
type foo_class real :: a contains procedure,pass(foo) :: foobar end subroutine foobar(foo,bar) class(foo_class) :: foo class(bar_class) :: bar ... end ... type(foo_class) :: a type(bar_class) :: b call a%foobar(b)
I’m not entirely sure about whether this is even valid FORTRAN. In principle, one could use subroutine foobar with any data type inheriting from foo_class or bar_class. And the routine could be used as a type bound routine from either type.
Anyways, calling this type of routine leads to ICEs. Optional arguments also seem to break the code. Keeping only one CLASS declaration seems to get rid of the problem. Additionally, CLASS declarations outside the module where the derived type is declared is also not working well.