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

Looking for Fortran 95 *expert* to help me with pointers.

marshall_buhl
Beginner
216 Views
Hi,
I've been programming in FORTRAN/Fortran since 1971 and am considered my laboratory's leading Fortran expert (sad, but true). I've been using F95 for quitea while now, but only recently started using pointers and linked lists. I'm having trouble getting my program to work properly and I have no one I know to turn to for help.
Is there anyone out there who can help me debug my program? I may even be able to find a way to pay for it. I need someone who is really good with this stuff.
Each item in my linked list containsan array and a pointer to the next item in the list. I followed the linked-list example in "Fortran 90/95 for Scientists and Engineers", but it doesn't work in all cases. It *may* be a compiler bug, but I have no way to prove it. Putting in print statements to find out what is wrong sometimes makes the problem go away and the problem is different when I compile for release than it is in debug mode. I may just be clobbering the instructions so that's why adding print statements moves the problem around or makes it go away.
Useful help will be greatly appreciated and save a lot of the taxpayers' money.
Marshall
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
216 Views
Sorry, don't have time for it -- I'd just offer an advice: are you aware of F95 "default component initialization" feature -- it saves you a lot of headaches when debugging such codes (which can be tricky to get right).
Briefly, you can put initialization statements within TYPE definition -- every time an item of given type is created (allocated), it is guaranteed to receive such values:
TYPE LinkList
TYPE (LinkList), POINTER:: Next => NULL()
TYPE (Whatever), POINTER:: Data(:) => NULL()
END TYPE LinkList
NULL guarantees that any attempt to access such data will result in an access violation, catchable by debugger.
Jugoslav
0 Kudos
Reply