Open jwshii opened 6 months ago
Just poking around in the CN checking code, it looks like this particular flavor of UB only ever happens when the value is not representable at an integer type (see here).
This error message does not say this specifically - I think it is defined here. A simple solution would be to make this message more descriptive, eg:
"This expression may compute an integer value that cannot be represented at the current type - typically, this means the value may underflow or overflow"
To distinguish over / underflow, I suppose we'd need to modify is_representable_integer
(defined here). It looks like the current version doesn't discriminate between under and overflow, but maybe these could be proved separately?
Btw, it might be good to have each distinct UB print an error code, since such codes already exist internally here. Then we could have some kind of per-error lookup table to help users triage messges.
(I think generally having some "typically, this means" in error messages would be extremely helpful!)
(Ported from the CN heuristic evaluation results.) One participant said:
For example, the code here
produces the same error
if either the
<= sum
or thesum <=
constraints are removed.Would a more explicit error message here indicating the possibility of underflow / overflow be possible?