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
intmain() {
unsignedu=0xffffffffu;
// since the double type seems to be implemented with a IEEE 754 binary64// format in CBMC, which has 53 bits of mantissa, double has enough bits to// represent the exact value of u, use, e.g., http://weitz.de/ieee/ to check;// therefore, C17, section 6.3.1.4, paragraph 2 says that this is// defined behavior and d should store the exact value that u storesdoubled=u;
// defined behavior behavior as well, by C17 section 6.3.1.4, paragraph 1,// because the 'unsigned' type can represent the value; however,// cbmc --conversion-check complainsu= (unsigned) d;
return0;
}
doesn't have undefined behavior in the double-to-unsigned conversion, according to C17, section 6.3.1.4, paragraph 1, but
cbmc --conversion-check main.c
in Linux, using latest develop, complains about an arithmetic overflow.
The text was updated successfully, but these errors were encountered:
We use less-than in the comparison, so make the bound one larger than
the largest representable value (as we do in the other cases of
float-to-signed/unsigned conversion checks).
Fixes: diffblue#8131
The below program
doesn't have undefined behavior in the double-to-unsigned conversion, according to C17, section 6.3.1.4, paragraph 1, but
in Linux, using latest
develop
, complains about an arithmetic overflow.The text was updated successfully, but these errors were encountered: