- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
program test
write ( *,* ) ' ih = ', ih
call exit
end
I get the following result
ih = -1757079179
Drcken Sie eine beliebige Taste . . .
I'mshure, that this worked in the versions before, the result was 0. This is a problem for me, because I migratet all my programs from digital fortran to intel. In df all scalar values were 0 when starting. This made me some problemswith the Intel compiler till I found the /qzero option. Now the problem seems to be back.
Link Copied
- 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'd hesitate to say that "correct" options exist for source code with undefined variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main problem is that if the initialization is not done, the variable's value is unpredictable. It may be zero, it may be something else that could change from run to run.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I have a look on my sources to find such unsetted variables and set them. Is there a compiler option to help my find such.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If your program uses uninitialized variables, then your program is not compliant with the Fortran standard, even if they have previously worked with other compilers. Rather than expecting the compiler to behave as you would like them (either with or without particular compiler switches), you should aim to make your program compliant with the standard. This means initializing all variables before you use them.
Regards,
David
- 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
Under project properties Fortran -> Run-time -> Runtime Error Checking
you can check for uninitialized variables
I would advise you to also check array and string bounds
All of my Debug configurations have check "all" andsome of my Release configurationshave check for uninitialized variables and bounds checking (plus traceback) so that in the event of a user encountering a problem a screen shot will hopefully show us where and what.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The options /RTCu /traceback seems to function similarly.
The trapping of undefined variables is probably unavailable or incomplete for user-defined variable types and arrays.
- 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
zero, Qzero
Initializes to zero all local scalar variables of intrinsic type INTEGER, REAL, COMPLEX, or LOGICAL that are saved but not yet initialized.
Use -save (Linux and Mac OS X) or /Qsave (Windows) on the command line to make all local variables specifically marked as SAVE.
So these options only work for scalars (i.e not arrays), and the variable need to be saved, which I think you said you did not want to do.
No other choices it would appear.
Regards,
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page