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

Runtime error with polymorphic pointer

MDK
Beginner
440 Views
[plain]module ifort_bug_mod

    implicit none
    
    type :: base_t
        integer :: dummy = 0
    end type
    
end module


program ifort_bug

    use ifort_bug_mod
    
    implicit none
    type(base_t), pointer :: p_ok => null()
    class(base_t), pointer :: p_err => null()
    type(base_t), target :: base

    p_ok => base ! ok
    p_err => base  ! runtime error

end program[/plain]

As far as I can tell this is a compiler bug (v11.1.051). As you can see, simply associating a polymorphic pointer with a target causes a runtime error.
0 Kudos
2 Replies
thomas_boehme
New Contributor II
440 Views
Quoting - MDK
[plain]module ifort_bug_mod

    implicit none
    
    type :: base_t
        integer :: dummy = 0
    end type
    
end module


program ifort_bug

    use ifort_bug_mod
    
    implicit none
    type(base_t), pointer :: p_ok => null()
    class(base_t), pointer :: p_err => null()
    type(base_t), target :: base

    p_ok => base ! ok
    p_err => base  ! runtime error

end program[/plain]

As far as I can tell this is a compiler bug (v11.1.051). As you can see, simply associating a polymorphic pointer with a target causes a runtime error.

That's a bug introduced in v11.1.051. I already reported in in following thread:
http://software.intel.com/en-us/forums/showthread.php?t=69682

As a workaround, you can disable Diagnostics->Generate Interface Blocks and Diagnostics->Check Routine Interfaces. See the above mentioned thread for details.

regards,
Thomas
0 Kudos
MDK
Beginner
440 Views
Quoting - thomas_boehme

That's a bug introduced in v11.1.051. I already reported in in following thread:
http://software.intel.com/en-us/forums/showthread.php?t=69682

As a workaround, you can disable Diagnostics->Generate Interface Blocks and Diagnostics->Check Routine Interfaces. See the above mentioned thread for details.

regards,
Thomas

Thanks!
0 Kudos
Reply