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

Unassociated pointer returns as associated

jpapp
Beginner
572 Views
Another nerve-racking issue trying to get a F2003 test code up and running. I'm using ComposerXE 2011.sp1.9.293. I'm working with some test code with linked lists, which I was finally able to compile after working through some yet to be fixed compiler bugs. Anyway, now I'm running into a problem where a pointer that points to a null value returns that it is associated. For instance:

associated(this%next) returns false
curr => this%next
associated(curr) returns true

I've printed out the loc() results for both this%next and curr variables and they both point to '0' so I'm at a loss why associated(curr) returns true. Unfortunately, a simple test code always works and this seems to be an artifact of possibly another bug, so I've included all the source code. The error occurs at line 63 of link.f90. I'm using standard compiler options:

ifort -o LnkTst link.f90 list.f90 main.f90

Running LnkTst always produces a segmentation fault because associated(curr) returns true. I know how to work around this (just do an associated(this%next) instead) but I'm pretty sure that this problem is indicative of an error somewhere else. Usually, I start printing out pointer addresses to make sure I didn't inadvertantly change pointer locations, but when I attempt to print addresses for the 'this' pointer, I always get some huge value rather than the standard 4 bit integer. Next step is to try and debug with valgrind and see if that helps.

Anyway, here is the source code for all three files. Any help would be appreciated.

Thanks,

John

0 Kudos
4 Replies
jpapp
Beginner
572 Views
As a side note, I was able to get this code to work with no problems using PGI compiler v12.2

John
0 Kudos
Steven_L_Intel1
Employee
572 Views
I think I have seen this before - let me take a look.
0 Kudos
Steven_L_Intel1
Employee
572 Views
This is apparently a different twist on a problem we fixed. I have escalated it as issue DPD200179858. If you test on associated(this%next), the program will run. Thanks for bringing this to our attention.
0 Kudos
Steven_L_Intel1
Employee
572 Views
This has been fixed for a release later this year.
0 Kudos
Reply