- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
While trying to build a linked list of extended types, I came upon the following problem. The association of the next pointer cannot be done directly, but results in a segmentation fault. I have attached an example that demonstrates the problem. All compilations were done with:
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091012 Package ID: l_cprof_p_11.1.059
which is the latest version as far as I know.
Any help?
program example
implicit none
type :: p_type
class(p_type),pointer::next=>null()
end type
type, extends(p_type)::pz_type
double complex::z
end type
type, extends(p_type)::pr_type
double precision::r
end type
class(p_type),pointer::p=>null(),cp=>null(),cp2=>null()
allocate(pr_type :: p)
cp=>p
select type(cp)
type is (pr_type)
cp%r=1d0
end select
!like it should work, but doesn't
! cp=>cp%next
!workaround:
cp2=>cp%next
cp=>cp2 !rather useless
end program example
While trying to build a linked list of extended types, I came upon the following problem. The association of the next pointer cannot be done directly, but results in a segmentation fault. I have attached an example that demonstrates the problem. All compilations were done with:
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091012 Package ID: l_cprof_p_11.1.059
which is the latest version as far as I know.
Any help?
program example
implicit none
type :: p_type
class(p_type),pointer::next=>null()
end type
type, extends(p_type)::pz_type
double complex::z
end type
type, extends(p_type)::pr_type
double precision::r
end type
class(p_type),pointer::p=>null(),cp=>null(),cp2=>null()
allocate(pr_type :: p)
cp=>p
select type(cp)
type is (pr_type)
cp%r=1d0
end select
!like it should work, but doesn't
! cp=>cp%next
!workaround:
cp2=>cp%next
cp=>cp2 !rather useless
end program example
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reporting this and for the convenient reproducer. Sure looks like a bug. I reported it to Development and will keep this thread updated as I learn more.
(Internal tracking id: DPD200148476)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A great, thanks for the response.
I just wanted to add that if you allocate the next pointer (as any type within the class), then the pointer association is no problem (cp=>cp%next). However, when cycling through a linked list then the situation described above will (of course) occur at the end of the list. It seems to me that the problem must lie with the null() pointer.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I passed that extra information along to Development. I'll keep you posted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I confirmed this defect will be fixed in the upcoming 11.1 update 5 in late January/early February.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11.1 Update 5 (11.1.069 - Linux) is now available.
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