Skip to content

Commit

Permalink
Type consistent string preprocessing for floating-point expressions
Browse files Browse the repository at this point in the history
While the test was previously marked THOROUGH it would actually fail with

warning: ignoring <=
  * type: bool
  0: constant
      * type: floatbv
          * width: 64
          * f: 52
      * value: 0100000001000000101010101001111110111110011101101100100010110100
      * #source_location:
        * file: StringValueOf09.java
        * line: 5
        * function: java::StringValueOf09.main:([Ljava/lang/String;)V
        * java_bytecode_index: 1
  1: constant
      * type: floatbv
          * width: 32
          * f: 23
      * value: 10111010100000110001001001101111

and similar warnings as double- and single-precision values got mixed up.
  • Loading branch information
tautschnig committed Dec 8, 2017
1 parent a61ea38 commit 18f9079
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion regression/jbmc-strings/StringValueOf09/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
THOROUGH
CORE
StringValueOf09.class
--refine-strings --string-max-length 1000
^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion src/java_bytecode/java_string_library_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ codet java_string_library_preprocesst::make_float_to_string_code(
exprt str=allocate_fresh_string(type.return_type(), loc, symbol_table, code);

// Expression representing 0.0
ieee_float_spect float_spec=ieee_float_spect::single_precision();
ieee_float_spect float_spec(to_floatbv_type(params[0].type()));
ieee_floatt zero_float(float_spec);
zero_float.from_float(0.0);
constant_exprt zero=zero_float.to_expr();
Expand Down

0 comments on commit 18f9079

Please sign in to comment.