Fortran: "cannot access address" or "reference through nil pointer"
807575Sep 29 2006 — edited Oct 4 2006Hi,
I'm experiencing a strange problem with my Fortran code. When I compile with "-g -openmp=noopt" I get strange results in a particular subroutine. Before presenting the details, I should mention the problem goes away if I remove the "-openmp=noopt" compiler option. I'm using Sun Fortran 95 8.2 Patch 121020-02 2006/04/06, on a Solaris 10/x86 machine.
My code wasn't behaving as expected, so I went into the debugger to find out what and where the problem was. I found the location of the problem and what was happening, but don't know what's causing it or how to fix it.
Specifically, I call a subroutine with a number of arguments (integers, single precision scalars, single precision arrays, character arrays) and upon entering the subroutine, I cannot access the values of the majority of the passed arguments anymore and I get error messages "cannot access address 0x3fa00000" or "reference through nil pointer". Meanwhile, the variables passed that I can still access no longer have the same values they did before the call to the subroutine.
Also, using the where command after I have called the subroutine gives me weird results. For example, most of the arguments as stated in the where command take the form "ibeg = <bad address 0x3fa00000>".
I've checked the variable assignments before the call to the subroutine and they're all as they should be. Also, there are no parallel regions around the call to this subroutine and I have confirmed that this part of the code, is in fact, serial. In addition, none of the arguments I am passing to the subroutine are calculated inside a parallel region. If it makes any difference, there is a file open when the subroutine is called.
Any help or guidance I could get in resolving this problem would be much appreciated.
Thanks in advance,
Jon
Message was edited by:
PerryBothron