[cfe-dev] ubsan false positives with float<->double NaN conversions?

Sean McBride sean at rogue-research.com
Wed Mar 20 08:08:01 PDT 2013


On Tue, 19 Mar 2013 18:42:20 -0700, Richard Smith said:

>So I suggest we split float-cast-overflow into two checks, one for
>floating-integral conversions and one for floating point conversions, and
>we suggest that people who want to use IEEE 754 floating-point semantics
>turn the latter check off. Would that work for you?

That would be a great improvement.

Perhaps you're already saying this, but IMHO it would be nice if the dividing line were IEEE-754 vs not.  Practically speaking, I need to deal with NaN and Inf 'normally', but would still benefit from double->float truncation warnings, like:

  double d = DBL_MAX - 1000.0;
  float f = (float)d;

  runtime error: value 1.79769e+308 is outside the range of representable values of type 'float'

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list