- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a possible bug when using methods for structures/classes that have pointers pointing to an type implicitly passed as a method argument. Best explained with the example.
I'm compiling with non commercial intel fortran composerxe-2011.5.220.
Source is:
[fortran]MODULE myTypeMod TYPE myType INTEGER :: i TYPE(myType), POINTER :: selfPointer => NULL() CONTAINS PROCEDURE, PUBLIC :: fun PROCEDURE, PUBLIC :: fun2 END TYPE myType TYPE myBox TYPE(myType), POINTER :: headList => NULL() END TYPE myBox CONTAINS !======================================================================== SUBROUTINE fun(head) CLASS(myType), TARGET, INTENT(IN) :: head WRITE(*,*) "Associated(ptr):", ASSOCIATED(head.selfPointer) WRITE(*,*) "Associated(ptr,head):", ASSOCIATED(head.selfPointer,head) WRITE(*,*) END SUBROUTINE fun !======================================================================== !======================================================================== SUBROUTINE fun2(head,head_2) CLASS(myType), TARGET, INTENT(IN) :: head TYPE(myType), TARGET, INTENT(IN) :: head_2 WRITE(*,*) "Associated(ptr):", ASSOCIATED(head.selfPointer) WRITE(*,*) "Associated(ptr,head):", ASSOCIATED(head.selfPointer,head) WRITE(*,*) "Associated(ptr,head_2):", ASSOCIATED(head.selfPointer,head_2) WRITE(*,*) END SUBROUTINE fun2 !======================================================================== END MODULE myTypeMod PROGRAM test USE myTypeMod TYPE(myBox) :: box ! Short Hands TYPE(myType), POINTER :: listHead => NULL() ! Generating list header ALLOCATE(box.headList) box%headList%selfPointer => box%headList listHead => box.headList WRITE(*,*) "Printing List mode 1" CALL fun(listHead) WRITE(*,*) "Printing List mode 2" CALL listHead.fun() WRITE(*,*) "Printing List mode 3" CALL box%headList%fun() WRITE(*,*) "Printing List mode 4" CALL box%headList%fun2(listHead) END PROGRAM test[/fortran]
The Output is
[bash] Printing List mode 1 Associated(ptr): T Associated(ptr,head): T Printing List mode 2 Associated(ptr): T Associated(ptr,head): T Printing List mode 3 Associated(ptr): T Associated(ptr,head): F Printing List mode 4 Associated(ptr): T Associated(ptr,head): F Associated(ptr,head_2): T [/bash]
I'm not sure if this is a bug or just a misuse of the class methods. But "Mode 3" fails to associate the pointer belonging to the substrucure with the implicit argument of the function fun used as a class method.
Dario Isola
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are tracking this under the internal id noted below andI will post more when I learn it.
(Internal tracking id: DPD200173456) (Resolution Update on 10/14/2012): This defect is fixed in the Intel® Fortran Composer XE 2013 Initial Release (2013.0.0.079 - Linux)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good to know that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page