https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125298
--- Comment #6 from aldy at quesejoda dot com ---
On Tue, Dec 01, 2026 at 08:59:10PM +0000, amacleod at redhat dot com wrote:
> >
> > 954 inline
> > 955 value_range::value_range (tree min, tree max, value_range_kind kind)
> > 956 {
> > 957 init (TREE_TYPE (min));
> > 958 m_vrange->set (min, max, kind);
> > 959 }
> >
> > when m_cst_expr is a NaN. Presumably for this case we want a VR_NAN.
> >
> > Andrew, is there a way to set a value_range to be a singleton from a tree
> > cst? (rather than setting it to a min/max range where both min == max ==
> > the tree cst, as the analyzer is constant_svalue::maybe_get_value_range_1 is
> > currently doing)
>
> no, but this seems more like a bug in frange::set()... seems like if min or
> max is a NaN, then it ought to verify they both are and then call the
> approriate set_nan. guess that kind of call has not happened yet! first!
It was by design. We only allow setting of NANs with the set_nan()
methods, so the caller has to think about the NAN case.
We agreed at one time that using set() to set a NAN would be
confusing, because NAN isn't a number ;-). But I don't remember
anyone being dead set against it. I'm certainly not.
If y'all agree it's better to allow this, then you can implement it,
taking care that both min and max are a NAN, cause set(5.0, NAN) is
just asking for trouble :).
Aldy