- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a code which was working fine. In trying to compare to some experimental results, I changed all of my real variables to double precision, at which point I got an access violation message, where an integer array is said to have an undefined address (the whole array, not just elements within it). If I go back to single precision real, it works fine.
In trying to narrow the problem down, I inserted a statement at the very top of the main code which tries to initialise the integer array, but I get the same problem.
Why does changing from single to double precision real affect the access of an integer array?
I am using compiler version 11.0.075, in Visual Studio 2005.
In trying to narrow the problem down, I inserted a statement at the very top of the main code which tries to initialise the integer array, but I get the same problem.
Why does changing from single to double precision real affect the access of an integer array?
I am using compiler version 11.0.075, in Visual Studio 2005.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does your code contain COMMON with EQUIVALENCE?
The size change in real may move the former positions of equivalence.
Also, your calling arguments may now be messed up. Try geninterfaces and check interfaces (and use IMPLICIT NONE if possible)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim,
Thanks for your response. I am using IMPLICIT NONE, and I do not have any COMMON statements.
The error occurs before any calls are made.
Richard
Thanks for your response. I am using IMPLICIT NONE, and I do not have any COMMON statements.
The error occurs before any calls are made.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Richard Moser
Jim,
Thanks for your response. I am using IMPLICIT NONE, and I do not have any COMMON statements.
The error occurs before any calls are made.
Richard
Thanks for your response. I am using IMPLICIT NONE, and I do not have any COMMON statements.
The error occurs before any calls are made.
Richard
Do you have any EQUIVALENCE statements ?
As jim mentioned turn on interface checking (Project->Properties->Fortran->Diagnostics)
If that doesn't show up any compile messages then :
The usual suspects :
turn on all debugging flags : (Project -> Properties -> Fortran -> Run-time -> Runtime Error checking : ALL
Put a "breakpoint" on the first statement of your program
Run your program (in debug mode of course)
It should stop on thatfirst breakpoint
Pressing F10 will then step though the program one statement at a time until you get to the error. This should give you a better idea of where the problem lies.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Les Neilson
Do you have any EQUIVALENCE statements ?
As jim mentioned turn on interface checking (Project->Properties->Fortran->Diagnostics)
If that doesn't show up any compile messages then :
The usual suspects :
turn on all debugging flags : (Project -> Properties -> Fortran -> Run-time -> Runtime Error checking : ALL
Put a "breakpoint" on the first statement of your program
Run your program (in debug mode of course)
It should stop on thatfirst breakpoint
Pressing F10 will then step though the program one statement at a time until you get to the error. This should give you a better idea of where the problem lies.
Les
Les,
I don't have any EQUIVALENCE statements in the code. Interface checking was already active, with no messages during compilation, and runtime error checking was set to ALL.
I had already moved the troubled statement to the very start of the main program, to ensure that no other routines were interfering.
I declare my integer array as INTEGER N_ORDS(6)
My first executable statement in the code is then:
DO I = 1, 6
N_ORDS(I) = 0
ENDDO
and it fails on execution, listing the elements of N_ORDS as having an undefined address. There are also other (single value) integer variables which are listed as this. All REAL variables seem to be ok (uninitialised, but having an address).
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Richard,
Can you submit a simple example program that exhibits this behavior?
Note,
If you are debugging the Release build with optimizations, and if N_ORDS is not used, or used only within that routine (but not modified after initialization) then the compiler might optimize out the N_ORDS array.
Jim Dempsey

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