- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adrian
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can't get this to compile, it's upset with the # syntax. I think it needs to be !DEC$ something, but I can't get the syntax right for the array(i) #define.
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you get the array bounds error, bring the console window to the front - does it identify the source file and line?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was asking about the array bounds problem where you could not see where in the source the error occurred.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it doesn't stop at all if I have all checking on except "Check Uninitialized Variables"
compiler options are:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Message Edited by lpe@scandpower.no on 11-11-2005 04:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Why dounitialized variables havestrange values like 1.0E-307 in the debugger?
Lars Petter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The Floating Point Processor (core) can be set to generate traps on certain errors. e.g. trap on divide by 0, underflow, overflow and some others. The bit patterns in the encoded numbers in addition to containing numbers have a few special case values (or value ranges). One of these values (two if you count the difference in sign bit) is given a value of Not A Number, (there is also + and - infinity, and then subnormal numbers).
When you set the compiler to trap on uninitialized variables one of the techniques employed by the compiler is to initialize the variables to Not A Number (NaN). Your code can overwrite a NaN without trapping but if one of these are read (and the FPU has been setup to trap on NaN) then a trap will occure and you receive a break into the debugger.
A second way to trap uninitialized numbers (an Intel person might correct me) is for the compiler to generate an address for the variable which is an invalid address. On first reference to the variable if the reference is a read then the invalid address trap is converted into a trap for reference of variable before initialization. Should the first access be a write then the address for the variable is modified to a valid address. One way to do this trick is to use self modifying code (which is frowned upon). A second way is to make all variables references i.e. the variable is not the address of the data, instead the variable contains the address of the data (similar to a dummy argument). Now after first reference the address of the data inside the variable can be updated without worry about using self modifying code.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ferrad,
The screenshot error doesn't make sense. It would appear that lbound or ubound is failing. Which shouldn't be the case. This could be a compiler problem (another thread in this forum is talking about this subject).
For your purposes you know the proper lbound and most likely the ubound of your array that is failing. (the demo case used 1:10). Your code may be using an integer parameter for the size of the array (and from prior discussions 1 is the lbound of the array).
Replace the lbound(...) and ubound(...) with the correct bounds for your array.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
array(11) = 11.
array(-1) = -1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ferrad,
You must interpret the code postings and adapt the code to your particular needs.
Snip of code from my prior post:
if((i .lt. lbound(was_array,dim=1)) .or. (i .gt. ubound(was_array,dim=1))) then
write(*,*) "gotcha - i=", i
#ifdef _DEBUG
iChk = lbound(was_array,dim=1)
#else
stop
#endif
endif
Interpretation:
When compiled in the Debug configuration the program will not Break and the program will not stop (the stop statement is not compiled in Debug).
Instead of breakingthe program forces the array index to 1. The intention here is (when in Debug) for you to place a Break Point at the location:
iChk = lbound(was_array,dim=1)
Or because of your prior lbound problem at your edited line:
iChk = 1
The purpose of the _DEBUG conditional compile section setting the index to 1 is that this permits you, when entering your break condition, to write down the caller information .AND. then continue running with the invalid index set to 1. Note, it is true that your program is continuing using an incorrect index. However, it is also true that should you decide to continue with the invalid index that you may also encounter a subsiqent index error, thus catching multiple bugs in one debug session. Now then, if after examining the caller of the first instance of the incorrect error, you determine it would be of no benifit to continue then simply stop the program.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it works well, thanks for the help. I had theubound problem on Friday, but when I recompiled this morning, I didn't have it. Who knows, probably some weird stuff I was experimenting with on Friday, but now it's OK.
BTW putting the #define line in seems to invalidate my
!DEC$ FIXEDFORMLINESIZE: 132
directive as now it's complaining about code after column 72. Are /fpp and !DEC$ incompatible?
Adrian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FPP and !DEC$ are not incompatible. FPP is sensitive to the fortran line length. If you set the fixed line length with !DEC$ then FPP might not know what the fixed length is. FPP must know what the line length is in order to construct continuation lines properly.
Try setting the line length via project option switches instead (as well). Or add the FPP option /e. The FPP options can be found using "fpp /help" on the command line. I think you may find using the ifort option for fixed line length more appropriate.
Jim Dempsey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »