Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28655 Discussions

Fatal compiler error with class() pointers

bdforbes
Beginner
435 Views
I am getting the message
fortcom: Fatal: There has been an internal compiler error (C0000005).
when I compile some code containing procedure pointers to functions returning class() pointers. I am using IVF Compiler XE 12.0.1.127, IA-32. Here is a code snippet that produces the behaviour:
[fortran]module polytest

    type base
        integer(4)::d
    end type base
    
    interface
        pure function ptr_func()
            import base
            class(base),pointer::ptr_func
        end function
    end interface
    
    procedure(ptr_func),pointer::p
   
    contains

        pure function get_ptr()
            class(base),pointer::get_ptr

            allocate(get_ptr)
            
        end function get_ptr
           
        subroutine test()
                    
            p => get_ptr
            
        end subroutine test
    
    
end module polytest[/fortran]
If I comment out the line p=>get_ptr, it compiles fine. I can fix the problem by using type() pointers instead of class() pointers, but I need polymorphism. Any advice on how to proceed?
0 Kudos
3 Replies
Steven_L_Intel1
Employee
435 Views
Thanks - I can reproduce the problem and will forward it to development. Issue ID is DPD200171895. If I can find a workaround I will let you know.
0 Kudos
Steven_L_Intel1
Employee
435 Views
This has been fixed for a future release - sorry, no workaround at this time.
0 Kudos
bdforbes
Beginner
435 Views
Thanks. I'm happy with tweaking the compilation of the single relevant source file to get it to work. It does not affect the rest of the program.
0 Kudos
Reply