You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What behaviour did you expect: Successful verification
What happened instead: Verification failed.
The result is unexpected because the commit that originally added support says "The result is always defined, even for zero (where the result is the bit width)". A similar thing happens if __builtin_clz is used instead.
The text was updated successfully, but these errors were encountered:
I believe the behaviour is as expected: __builtin_clz (or __builtin_ctz) are undefined for zero. That's GCC's semantics, not ones of our own choosing. What is, however, defined, is the value of the underlying expression count_leading_zeros_exprt and count_trailing_zeros_exprt, respectively -- which is all that the comment is referring to.
The previous implementation would produce an off-by-one error in case of
an argument 0, which count_trailing_zeros is defined for (even when
__builtin_ctz is undefined in that case).
Fixes: diffblue#6702
CBMC version: 5.50.0
Operating system: Ubuntu 20.04
Exact command line resulting in the issue: cbmc example.c, where example.c is
What behaviour did you expect: Successful verification
What happened instead: Verification failed.
The result is unexpected because the commit that originally added support says "The result is always defined, even for zero (where the result is the bit width)". A similar thing happens if
__builtin_clz
is used instead.The text was updated successfully, but these errors were encountered: