- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
WARNING: If the code below does not compile immediately, please Ctrl-C fast; otherwise, huge cores are being produced, and you may have to restart your workstation.
! Code from Figure 19.3 on page 324 of "Fortran 95/2003 explained"
! IFORT 15.0.1 compiles the code, and the program runs fine.
! IFORT 16.0.0 never returns from compilation; Ctrl-C causes
! huge core files to be created
Module list_module
Implicit None
Type node
Integer :: value = 0
Class(node), Pointer :: next_node => Null()
Contains
Procedure :: pwf
Generic :: Write(Formatted) => pwf
End Type node
Contains
Recursive Subroutine pwf(dtv, unit, iotype, vlist, iostat, iomsg)
Class(node), Intent(In) :: dtv
Integer, Intent(In) :: unit
Character(*), Intent(In) :: iotype
Integer, Intent(In) :: vlist(:)
Integer, Intent(Out) :: iostat
Character(*), Intent(InOut) :: iomsg
Character(10) :: pfmt
Write(unit, fmt = '(i9,/)', iostat = iostat) dtv%value
If(iostat /= 0) return
If(Associated(dtv%next_node)) Write(unit, fmt='(dt)', iostat=iostat) dtv%next_node
End Subroutine pwf
End Module list_module
Program test
Use list_module
Implicit None
Type(node), Target :: first_link = node(42, Null())
Type(node), Target :: second_link = node(43, Null())
Type(node), Target :: third_link = node(44, Null())
first_link%next_node => second_link
second_link%next_node => third_link
Print '(dt)', first_link
End Program test
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - I can reproduce this and escalated as issue DPD200381365. The key seems to be the component that is a pointer to its own type - if that is removed, it compiles. I suspect that the compiler is now trying to chase down the tree when it shouldn't, but I'll wait to see what the developers say.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Indeed, this is a bug that snuck in while we were redoing some code. I expect it to be fixed in Update 3.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page