File tree Expand file tree Collapse file tree 4 files changed +106
-7
lines changed
regression/cbmc-java/isnan1 Expand file tree Collapse file tree 4 files changed +106
-7
lines changed Original file line number Diff line number Diff line change 1+ CORE
2+ test.class
3+
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ ^VERIFICATION FAILED$
7+ assertion at file test.java line 37 .*: FAILURE
8+ assertion at file test.java line 45 .*: FAILURE
9+ assertion at file test.java line 49 .*: FAILURE
10+ assertion at file test.java line 53 .*: FAILURE
11+ assertion at file test.java line 57 .*: FAILURE
12+ assertion at file test.java line 41 .*: SUCCESS
13+ assertion at file test.java line 61 .*: FAILURE
14+ assertion at file test.java line 69 .*: FAILURE
15+ assertion at file test.java line 73 .*: FAILURE
16+ assertion at file test.java line 77 .*: FAILURE
17+ assertion at file test.java line 81 .*: FAILURE
18+ assertion at file test.java line 65 .*: SUCCESS
19+ --
20+ ^warning: ignoring
Original file line number Diff line number Diff line change 1+ public class test {
2+
3+ public static void main (int nondet ) {
4+
5+ float nan = 0.0f / 0.0f ;
6+ float one = 1.0f ;
7+ double nand = 0.0 / 0.0 ;
8+ double oned = 1.0 ;
9+
10+ if (nondet == 1 )
11+ checkeq (one , nan );
12+ if (nondet == 2 )
13+ checkneq (one , nan );
14+ if (nondet == 3 )
15+ checkgt (one , nan );
16+ if (nondet == 4 )
17+ checkgeq (one , nan );
18+ if (nondet == 5 )
19+ checklt (one , nan );
20+ if (nondet == 6 )
21+ checkleq (one , nan );
22+ if (nondet == 7 )
23+ checkeq (oned , nand );
24+ if (nondet == 8 )
25+ checkneq (oned , nand );
26+ if (nondet == 9 )
27+ checkgt (oned , nand );
28+ if (nondet == 10 )
29+ checkgeq (oned , nand );
30+ if (nondet == 11 )
31+ checklt (oned , nand );
32+ else
33+ checkleq (oned , nand );
34+ }
35+
36+ public static void checkeq (float arg1 , float arg2 ) {
37+ assert arg1 == arg2 ;
38+ }
39+
40+ public static void checkneq (float arg1 , float arg2 ) {
41+ assert arg1 != arg2 ;
42+ }
43+
44+ public static void checkgt (float arg1 , float arg2 ) {
45+ assert arg1 > arg2 ;
46+ }
47+
48+ public static void checkgeq (float arg1 , float arg2 ) {
49+ assert arg1 >= arg2 ;
50+ }
51+
52+ public static void checklt (float arg1 , float arg2 ) {
53+ assert arg1 < arg2 ;
54+ }
55+
56+ public static void checkleq (float arg1 , float arg2 ) {
57+ assert arg1 <= arg2 ;
58+ }
59+
60+ public static void checkeq (double arg1 , double arg2 ) {
61+ assert arg1 == arg2 ;
62+ }
63+
64+ public static void checkneq (double arg1 , double arg2 ) {
65+ assert arg1 != arg2 ;
66+ }
67+
68+ public static void checkgt (double arg1 , double arg2 ) {
69+ assert arg1 > arg2 ;
70+ }
71+
72+ public static void checkgeq (double arg1 , double arg2 ) {
73+ assert arg1 >= arg2 ;
74+ }
75+
76+ public static void checklt (double arg1 , double arg2 ) {
77+ assert arg1 < arg2 ;
78+ }
79+
80+ public static void checkleq (double arg1 , double arg2 ) {
81+ assert arg1 <= arg2 ;
82+ }
83+
84+ }
Original file line number Diff line number Diff line change @@ -2048,11 +2048,6 @@ codet java_bytecode_convert_methodt::convert_instructions(
20482048 else if (statement==patternt (" ?cmp?" ))
20492049 {
20502050 assert (op.size ()==2 && results.size ()==1 );
2051- const floatbv_typet type (
2052- to_floatbv_type (java_type_from_char (statement[0 ])));
2053- const ieee_float_spect spec (type);
2054- const ieee_floatt nan (ieee_floatt::NaN (spec));
2055- const constant_exprt nan_expr (nan.to_expr ());
20562051 const int nan_value (statement[4 ]==' l' ? -1 : 1 );
20572052 const typet result_type (java_int_type ());
20582053 const exprt nan_result (from_integer (nan_value, result_type));
@@ -2062,8 +2057,8 @@ codet java_bytecode_convert_methodt::convert_instructions(
20622057 // (value1 == NaN || value2 == NaN) ?
20632058 // nan_value : value1 == value2 ? 0 : value1 < value2 -1 ? 1 : 0;
20642059
2065- exprt nan_op0= ieee_float_equal_exprt (nan_expr, op[0 ]);
2066- exprt nan_op1= ieee_float_equal_exprt (nan_expr, op[1 ]);
2060+ isnan_exprt nan_op0 ( op[0 ]);
2061+ isnan_exprt nan_op1 ( op[1 ]);
20672062 exprt one=from_integer (1 , result_type);
20682063 exprt minus_one=from_integer (-1 , result_type);
20692064 results[0 ]=
You can’t perform that action at this time.
0 commit comments