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

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

imagem de Antti Karanta

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. http://dlang.org/faq.html#nan

3 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de Tim Prince

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

http://www.nas.nasa.gov/hecc/assets/pdf/training/UnInit_Fix_your_code_20...

imagem de Steve Lionel (Intel)

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

Faça login para deixar um comentário.