https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125298

--- Comment #8 from Andrew Macleod <amacleod at redhat dot com> ---
Given the internal comments, it seems there are 2 important things:

1 - By design, set_nan should be explicitly called to ensure the caller is
doing the right thing and getting what they expect.  We do this oin other
situations which can be ambiguous. (Like the invert of an undefined value.  
Sometimes the caller might want UNDEFINED, other times they want VARYING.  So
the caller is forced to manually handle the situation if it comes up, avoiding
the issue) 

2 - NaNs are not considered singletons.  Singletons are defined not only as a
range where the upper bound and lower bound are the same, but also that the
range has a single value.   NaNs are not values, and therefore not considered
singletons.   Altering this could easily break code elsewhere.. A common idiom
is to check for a singleton and the single value returned is expected to be a
constant value which we can propagate into statements. If we allowed NaNs in
singletons, we'd probaly have to guard a lot of uses. 

So, given that, I think the calling code needs to check if it a NAN, and then
manually set the value range to an frange and call set nan.  And yes, probably
safer in the analyzer for now.  It would basically be the same code in
value_range::set (), and since yours is the only current need, Id suggest
putting it there for now.   We could revisit lifting that to value_range next
stage 1 if it seems like its needed elsewhere as well.

Reply via email to