Document def_exc and enums exclusion bit range assumption#1726
Conversation
7d9273f to
73e440e
Compare
| if M.tracing then M.tracel "cast" "Cast %a to range [%a, %a] (%a) = %a (%s in int64)" GobZ.pretty x GobZ.pretty a GobZ.pretty b GobZ.pretty c GobZ.pretty y (if is_int64_big_int y then "fits" else "does not fit"); | ||
| y | ||
|
|
||
| (** @return Bit range corresponds to {e some} {!ikind}, so always includes 0. *) |
There was a problem hiding this comment.
Does this hold in the case of Unsigned? It seems we try to fit it into a smaller type here: a, upper_bound_less?
There was a problem hiding this comment.
Ugh, yes, it's not even true here, so I'll remove it.
This does point to bunch of old stuff though. Namely PR #100 which introduced this special behavior to fix some non-associativity problems.
The oddity is how the range doesn't depend on the ikind being used, but the smallest ikind that would fit the value and match the sign of the value. So even with int (with bit range [-31,31]) value 2e9, this otherwise would return [0,32] (for unsigned int). And the special casing turns it into [0,31], which actually is a weaker form of #1723 as well.
My hypothesis is that #1723 should also solve the old non-associativity issue in a less hacky way, but that's beside the point here.
73e440e to
c5c752e
Compare
No description provided.