- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
using:
ifort (IFORT) 12.0.0 20101006
In this test case, I create a linked list of 4 elements with polimorphic objects, and when I traverse it, it only prints 3 of them.
using an alternate advance instruction, it shows all 4 objects, but it should work in both cases.
the output is:
---
35082336 0 0
35082496 0 0
35082656 0 0
---
35082336 0 0
35082496 0 0
35082656 0 0
35082816 0 0
---
that has 3 + 4 lines, but it should have 4 + 4 lines. the exact numbers shown may differ.
this is the attachment:
http://software.intel.com/file/m/32517
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, looks like a bug. I've modified the source a little to make it more clear where the bug is happening:
program pe
type, abstract :: t
integer :: i = 1
class(t), pointer :: next => null()
integer :: j = 2
end type
type, extends(t) :: u
integer :: k = 3
end type
type, extends(t) :: v
integer :: l = 4
end type
class(t), pointer :: ini => null()
class(t), pointer :: p => null()
class(t), pointer :: temp => null()
allocate(u :: ini)
allocate(v :: ini%next)
allocate(u :: ini%next%next)
allocate(v :: ini%next%next%next)
print *, '---'
p => ini
do while (associated(p))
print *, "current element", loc(p),"next associated?-->",associated(p)
print *, " traverse to next element "
p => p%next
print *, "next element", loc(p),"next associated?-->",associated(p)
print *, " "
enddo
print*, "exited loop - why?"
print *, '---'
p => ini
do while (associated(p))
print *, "current element", loc(p),"next associated?-->",associated(p)
print *, " traverse to next element "
temp => p%next
p => temp
print *, "next element", loc(p),"next associated?-->",associated(p)
print *, " "
enddo
print *, '---'
deallocate(ini%next%next%next)
deallocate(ini%next%next)
deallocate(ini%next)
deallocate(ini)
end program
I'll start a bug report
program pe
type, abstract :: t
integer :: i = 1
class(t), pointer :: next => null()
integer :: j = 2
end type
type, extends(t) :: u
integer :: k = 3
end type
type, extends(t) :: v
integer :: l = 4
end type
class(t), pointer :: ini => null()
class(t), pointer :: p => null()
class(t), pointer :: temp => null()
allocate(u :: ini)
allocate(v :: ini%next)
allocate(u :: ini%next%next)
allocate(v :: ini%next%next%next)
print *, '---'
p => ini
do while (associated(p))
print *, "current element", loc(p),"next associated?-->",associated(p)
print *, " traverse to next element "
p => p%next
print *, "next element", loc(p),"next associated?-->",associated(p)
print *, " "
enddo
print*, "exited loop - why?"
print *, '---'
p => ini
do while (associated(p))
print *, "current element", loc(p),"next associated?-->",associated(p)
print *, " traverse to next element "
temp => p%next
p => temp
print *, "next element", loc(p),"next associated?-->",associated(p)
print *, " "
enddo
print *, '---'
deallocate(ini%next%next%next)
deallocate(ini%next%next)
deallocate(ini%next)
deallocate(ini)
end program
I'll start a bug report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
bug report ID is DPD200163749
btw - this is a very clean and nice example of using F03 to create linked lists! Great use of F03 features.
ron
btw - this is a very clean and nice example of using F03 to create linked lists! Great use of F03 features.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
this bug was fixed some time ago. marking it closed, thanks for sending this to us!
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