Commit Graph

92 Commits

Author SHA1 Message Date
Michael Tautschnig c1baa03b2e Remove redundant string initialisation
Both std::string and dstringt are default-initialised to an empty string.
2019-04-30 22:30:57 +00:00
Michael Tautschnig 848e633b67 Use bv_typet to fix type consistency in byte-operator lowering
Previously we fixed the extracted bytes to be unsigned bitvectors, but
we should not actually impose (un)signedness as we do not actually
interpret the bytes as numeric values. This fixes byte operators over
floating-point values, and makes various SMT-solver tests pass as the
SMT back-end is more strict about typing and therefore was more
frequently affected by this bug.

To make all this work it was also necessary to extend and fix the
simplifier's handling of bv_typet expressions, and also cover one more
case of type casts in the bitvector back-end.

The tests
  Array_operations1/test.desc
  Float-equality1/test_no_equality.desc
  memory_allocation1/test.desc
  union12/test.desc
  union6/test.desc
  union7/test.desc
continue to fail on Windows and thus cannot yet be enabled.
2019-04-11 23:49:19 +00:00
Peter Schrammel 2096968df9 prop_conv_solvert is not a messaget
Gets a log member instead.
2019-03-27 14:18:12 +00:00
Romain Brenguier f9a698ce24 Remove root field of bdd_exprt
Instead the result of from_exprt and the input of as_expr should be
BDDs.
This makes it possible to reuse the same manager for several exprt
conversion and to combine the results obtain from the from_expr
conversion with BDD operations.
2019-03-07 11:02:35 +00:00
Romain Brenguier 4da4bd3dbe Remove unused field ns field of bdd_exprt
A reference to a namespace was stored without being ever used.
2019-03-07 11:02:35 +00:00
Romain Brenguier 94b2145fdd Move arguments into simplify_expr call
We use std::move in a few places where this is made possible by the
change in interface.
2019-02-28 15:09:02 +00:00
Michael Tautschnig 05af336b50 Byte-operator lowering: support structs containing bit-fields
This removes the constraint on aligned member accesses. Includes factoring out
of unpack_struct to avoid growing the size of unpack_rec even further.
2019-02-26 19:09:24 +00:00
Michael Tautschnig 6a0d998124 Rewrite byte_update lowering to respect endianness, support composite types
byte_update lowering now proceeds as follows:
1) Determine the size of the update, with the size of the object to be
updated as an upper bound. We fail if neither can be determined.
2) Turn the update value into a byte array of the size determined above.
3) If the offset is not constant, turn the object into a byte array, and
use a "with" expression to encode the update; else update the values in
place.
4) Construct a new object.
2019-02-26 19:09:24 +00:00
Romain Brenguier e1fb6b7fec Add unit test for BDD
This adds a test case to check there are no mistakes in the BDD to expr
conversions.
This test can fail without the previous fix.
2019-02-25 17:28:16 +00:00
Michael Tautschnig ec3ee8e039 byte_extract lowering for complex_typet
It may have worked before via the fallback to flattening of the entire
expression to a bitvector, but let's be on the safe side and construct
appropriate expressions.
2019-02-19 20:41:08 +00:00
Peter Schrammel 7cb1056b45 Add protected do_prop_solve for overriding
This will allow us to count solver invocations
without repeating the code in each propt implementation.
2019-02-18 22:41:39 +00:00
Daniel Kroening 93d5278b21 simplify_exprt::bits2expr now returns optionalt<exprt>
This prevents accidental modifications of a nil_exprt.
2019-02-16 19:34:52 +00:00
Michael Tautschnig 9a67ec4d55 Lowering of byte_extract over string constants
These need to be handled like arrays of characters.
2019-02-15 09:48:37 +00:00
Michael Tautschnig 004bd27a49 byte_extract lowering of pointers
Bit operations cannot be performed on pointers, thus type cast them to unsigned
bitvectors first and then convert back the result.
2019-02-14 20:52:31 +00:00
Michael Tautschnig 761ad8a2cb byte_extract lowering of unions
We previously handled unions like PODs.
2019-02-14 16:47:04 +00:00
Michael Tautschnig 5c3860636e byte_extract lowering of vectors and array cleanup
Refactor the code used for arrays to make it re-usable for vectors and arrays.
2019-02-14 15:24:53 +00:00
Michael Tautschnig d24e63f018 byte_extract lowering over arrays: fix bits vs bytes error
The offset is computed in bits.
2019-02-14 08:37:52 +00:00
Michael Tautschnig a3d77e6ac0 byte_extract lowering: ensure type consistency
Make sure we construct concatenations that are type consistent.
2019-02-14 07:09:44 +00:00
Michael Tautschnig 864fa155e6 byte_extract lowering: Fail when we _don't_ have a constant
Fixes: #4116
2019-02-07 17:32:35 +00:00
Michael Tautschnig 1f94bceb73 byte_extract lowering: lower newly introduced byte_extract expressions
byte_extract lowering must not return any further byte_extract expressions.
2019-02-07 11:24:47 +00:00
Michael Tautschnig 5a2df0d8b5 Fixes to the byte_operator lowering unit test
Let's only test byte extracts within bounds for now (there is ample work to be
done to get those right), but make sure there is possible combination for each
pair of types. Endianness needs to be taken into account when constructing the
expected value. Disable any non-POD tests as they all need more work.
2019-02-06 19:02:46 +00:00
Michael Tautschnig 884266786d
Merge pull request #4044 from tautschnig/propt-message-handler
Require a message handler when constructing a propt [blocks: #3800]
2019-02-04 16:48:18 +00:00
Michael Tautschnig 89641a2b47 Require a message handler when constructing a propt
Constructing a messaget without a message handler is deprecated.
2019-02-03 02:20:18 +00:00
Michael Tautschnig 82e08a7d27 A decision_proceduret does not need a namespace
This is a generic interface towards decisions procedures, there is no reason all
decision procedures should need a namespace.
2019-02-03 01:07:38 +00:00
Daniel Kroening 4dc7725e34 vector_typet::size() is now a constant_exprt
The codebase assumes basically globally that vector_typet::size() is a
constant_exprt.  This is now enforced by the signature.
2019-02-01 21:03:00 +00:00
Michael Tautschnig 1bba22fcb9 Unit test of byte operator lowering
The test attempts to systematically explore combinations of types, and shows a
number of current bugs or limitations.
2019-02-01 07:44:13 +00:00
Romain Brenguier 488652f96a Unit test for bdd_expr
Add a couple of basic tests for bdd_expr, in order to check that there
is no obvious mistake in the use of BDDs from bdd_expr.
2019-02-01 06:48:51 +00:00
Romain Brenguier 68bfb0b79b Move miniBDD to a new bdd module
This will allow us to have several implementations of BDD among which we
choose at compile time.
2019-02-01 06:48:46 +00:00
Romain Brenguier 8e8d11fb7e Reformatting miniBDD unit test 2019-02-01 06:48:44 +00:00
Michael Tautschnig 7c445677be CATCH: silence Visual Studio warnings
Wrap catch.hpp in a custom header use_catch.h that silences warnings, and make
all files use that header file instead.
2019-01-21 20:49:28 +00:00
Daniel Kroening 93a0994ac5 clang-format the moved files 2019-01-21 15:36:27 +00:00
Daniel Kroening 39a03aad7e move string solver into directory of its own
The string solver is now large enough to justify a separate directory.
2019-01-21 15:21:51 +00:00
Michael Tautschnig 475a7b959b Construct array_exprt in a non-deprecated way
The existing array_exprt constructor relies on other deprecated constructors;
instead introduce a non-deprecated one and use it across the codebase.
2019-01-21 09:26:26 +00:00
Michael Tautschnig 1ae4c0ba62 Construct array_list_exprt in a non-deprecated way
The existing array_list_exprt constructor relies on other deprecated
constructors; instead introduce a non-deprecated one and use it across the
codebase.
2019-01-13 09:46:30 +00:00
Michael Tautschnig 3e83ef8c83 Fix type mismatch between value at call site and declaration
All values passed in are of type unsigned long. Also remove an unnecessary const
with a POD parameter type.
2018-12-28 19:57:26 +00:00
Michael Tautschnig 3456903fca Fix whitespace in copyright headers
Uniformly format all Author and Module lines, and remove stray whitespace before
the end-of-header line. Also add in a missing "in" in some files to make the
grammar work out.
2018-12-21 10:04:49 +00:00
Michael Tautschnig c1e635ce74 Add missing module_dependencies.txt files
The directories had been created before such files were mandated by cpp-lint.
2018-12-02 10:32:27 +00:00
Michael Tautschnig fdf2a09faf Remove names of unused parameters
Removing the parameter completely is not an option for these as they are part of
inherited APIs, but at the same time the names do not have value in terms of
documentation.
2018-11-15 10:53:08 +00:00
Daniel Kroening 6dca32d4d1 format_expr: no parentheses if subexpression isn't an infix operator 2018-10-20 19:12:51 +01:00
Michael Tautschnig bd55a28bf8 Make the remaining (relevant) miniBDD catch-style unit tests 2018-09-18 09:23:44 +00:00
Michael Tautschnig 5e548bc062 Move miniBDD catch-style unit test to proper folder and include in Makefile 2018-09-18 09:23:44 +00:00
Michael Tautschnig e90b61bab3 Transform float_utils unit test to use CATCH and enable it
It now tests both the approximating and non-approximating version of
float_utilst.
2018-07-30 12:15:59 +01:00
Michael Tautschnig 86d057d42c (interval_)sparse_arrayt: Remove unnecessary use of "virtual" and further cleanup 2018-07-09 17:16:10 +01:00
Romain Brenguier b2089b7b58 Add unit test for array_poolt 2018-06-18 10:04:42 +01:00
Peter Schrammel 103c7b736f Add missing module definitions 2018-06-05 22:55:22 +01:00
Peter Schrammel b6742ca41e Move Java unit tests 2018-05-20 23:00:04 +01:00
Daniel Kroening 6c90b35cb8
Merge pull request #2052 from romainbrenguier/bugfix/default-axioms2#TG-2138
[TG-2138] Stop adding default axioms in string solver
2018-04-26 18:26:42 +01:00
Lukasz A.J. Wrona 78191ee066 Remove NOLINTs for lambdas. 2018-04-24 18:02:05 +01:00
Romain Brenguier b83182f822 Get rid of string_max_length field
In constraint generator, this was used for adding default axioms but is
no longer used.
2018-04-23 10:53:26 +01:00
Michael Tautschnig 58b990dd2a Use from_{expr,type} matching the language of the expression/type
For debugging output it's good enough to use the language-agnostic format(...).
In a few cases we do not have sufficient context to determine the mode/language,
which are now annotated with comments.
2018-04-19 01:28:42 +01:00