Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

A simple question

jscott
Novice
392 Views

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?

0 Kudos
9 Replies
DavidWhite
Valued Contributor II
341 Views

/check:uninint -- this is under the Run-time switches

jscott
Novice
231 Views

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.

0 Kudos
jimdempseyatthecove
Honored Contributor III
174 Views

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

0 Kudos
jscott
Novice
133 Views

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.

0 Kudos
JFScott
Beginner
77 Views

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.

0 Kudos
Steve_Lionel
Honored Contributor III
271 Views

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.

jscott
Novice
226 Views

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?

 

JohnNichols
Valued Contributor III
168 Views

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.  

jscott
Novice
126 Views

Thanks for your viewpoint. I will no doubt switch to IFX before long.

Steve deserves your accolade.

Reply