- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Having used FORTRAN for many years and IFORT for several, I am trying to verify a program.
As part of that, I wanted to check that variables are not used until assigned. However, the program
X=Y/Z
STOP
END
is accepted by IFORT without warnings.
I would have expected warnings that Y and Z are not assigned, but no. Is there some way of making IFORT issue warnings in such cases?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/check:uninint -- this is under the Run-time switches
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks David, but I was looking for a compile-time check.
As a run-time check, /check:uninit seems only to work for real variables which are not arrays. I am currently using /Qinit:snan,arrays for real-time checking, but it does not handle integers. Since there is no equivalent of NaN for integers, I can't see how run-time checking can be done in that case.
If you have further ideas, I am all ears.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Back in the early 1990's, Borland Turbo C/C++ would initialize references, including integers, that are yet to be initialized, to a page that was accessed inhibited. Upon first write, a page fault would occur, and the reference would be replaced with the intended address in a R/W accessible page, and the instruction re-issued. Should a Read occur first, then, this would cause a break into the debugger.
This could be used by Intel, but there may be other issues (e.g. execute-only pages).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. That would be a nice, clean way of doing it. Including integers and separating NaN's resulting from non-assignment from those coming from floating point operations.
I find your defense of Intel a bit weak. Why do execute-only pages exclude such data-faulting ones?
Seems to me this is just lack of effort on Intel's part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to note this does not address my original point of compile-time checking.
If IFX had compile-time and run-time checking of use of all unassigned variables with switches for integer/real, scalar/array (i.e. 4 choices in all), I would be there immediately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Enabling grouch mode here - back in the DEC days, both the older VAX FORTRAN compiler and the later GEM-based compilers could give you compile-time warnings when it could be proven there was a reference to an uninitialized variable. The move to Intel's IL0 back-end removed that capability, and the IL0 developers had no interest in implementing it. Worse, each Intel compiler that wanted to do run-time uninit checking was forced to roll their own. (We also lost GEM's excellent integer overflow checking, which never got added back.)
Now that LLVM is behind everything, it seems possible that there is a path to reinstating a valuable diagnostic, but there may not be interest in doing so. Allegedly, LLVM enables a better, common run-time check, but the evidence I have seen is that it is immature and perhaps limited to Linux at this point (at least it was initially - I don't know if that's still the case.)
I am a firm believer in giving diagnostics as early in the development process as possible, but I'm no longer in that game.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. I should first say that you are a bit of a hero of mine, so many times your posts have saved me. You are always spot on and to the point.
Disappointed that there seems to be no way to do what I wanted, but never mind. I still like the Intel compiler.
I agree with all your remarks. I too started out with DEC and am now retired, though still active (mainly in the area of high-end scientific computing with large numbers of processors in parallel). Good to find you still around to help.
I have yet to make the transition to IFX. Why change when the old version is sufficient?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In Visual Studio, changing to IFX is trivial and once you go to 2025 unless you are keeping the old, it is good idea.
Sooner or later you will be in a corner you have to do it, speaking from experience.
IFX has some minor quirks as has been discussed in this esteemed forum.
Steve is more than a hero, he is one of the Gods of computing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your viewpoint. I will no doubt switch to IFX before long.
Steve deserves your accolade.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page