On 5/9/24 04:47, HAO CHEN GUI wrote:
Hi Mikael,
Thanks for your comments.
在 2024/5/9 16:03, Mikael Morin 写道:
I think the canonical API behaviour sets R to varying and returns true instead
of just returning false if nothing is known about the range.
I'm not sure whether it makes any difference; Aldy can probably tell. But if
the type is bool, varying is [0,1] which is better than unknown range.
Should the varying be set by caller when fold_range returns false?
Just like following codes in value-query.cc.
if (!op.fold_range (r, type, r0, r1))
r.set_varying (type);
This would be dangerous in the general case. fold_range may have
returned false because 'type' is an unsupported range type. Generally
this is why we prefer range-ops to return TRUE and VARYING rather than
FALSE for unknown values. When FALSE is returned, we should stop
working with ranges because something is amok.
Andrew