Is there a command line option to initialize reals to NaN?

Is there a command line option to initialize reals to NaN?

I was wondering whether ifort has support (or plans thereof) for an option to initialize reals to NaN (in debug build or otherwise)? We have encountered several time consuming bugs where this might have helped.

I thought to ask this question as some time I read that the D programming language takes this approach to make errors with uninitialized reals more apparent, see e.g.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Did you consider the recommendations in Dave Barker's presentation?

We don't have current plans to do this, though various improvements to uninitialized variable detection continue to be discussed. With respect to NaN initialization, that is not as helpful as you might think since NaNs are allowed to participate in arithmetic operations. Another issue is that the processor automatically converts signaling NaNs to "quiet NaNs" upon a load into a register. Also, this does you no good for datatypes other than real/complex. It's one of those ideas that seems great at first, but then when you start poking and prodding the luster wears off.

We do currently offer a limited form of run-time uninitialized variable checking, though it is probably too limited to be useful. Users with a license for Fortran Studio XE or Parallel Studio XE (or Cluster Studio XE) can use the Static Analysis feature that does whole-program correctness checking, including uninitialized variable detection.  It too isn't perfect but it can be very helpful.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today