Skip to content

Commit 3587d9d

Browse files
author
Daniel Kroening
committed
added a test for hexadecimal floating-point trace values
1 parent 5169e7d commit 3587d9d

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

regression/cbmc/hex_trace/main.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
int main()
22
{
3-
int a;
4-
unsigned int b;
5-
a = 0;
6-
a = -100;
7-
a = 2147483647;
8-
b = a*2;
9-
a = -2147483647;
10-
__CPROVER_assert(0,"");
3+
int a;
4+
unsigned int b;
5+
float f;
116

7+
a = 0;
8+
a = -100;
9+
a = 2147483647;
10+
b = a * 2;
11+
a = -2147483647;
12+
f = 0.1f;
13+
14+
__CPROVER_assert(0, "");
1215
}

regression/cbmc/hex_trace/test.desc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ a=-100 \s*\(0xFFFFFF9C\)
99
a=2147483647 \s*\(0x7FFFFFFF\)
1010
b=4294967294ul? \s*\(0xFFFFFFFE\)
1111
a=-2147483647 \s*\(0x80000001\)
12+
f=0\.1f \s*\(0x3DCCCCCD\)
1213
^VERIFICATION FAILED$
1314
--
1415
^warning: ignoring

src/solvers/floatbv/float_bv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ exprt float_bvt::abs(const exprt &op, const ieee_float_spect &spec)
105105
// we mask away the sign bit, which is the most significant bit
106106
const mp_integer v = power(2, spec.width() - 1) - 1;
107107

108-
constant_exprt mask(integer2bvrep(v, spec.width()), op.type());
108+
const constant_exprt mask(integer2bvrep(v, spec.width()), op.type());
109109

110110
return bitand_exprt(op, mask);
111111
}

0 commit comments

Comments
 (0)