Commit Graph

20015 Commits

Author SHA1 Message Date
Matthias Weiss f84bf712cc Expand expr2statement_list
Adds support for the conversion of boolean expressions. Note that this
will hardly have any effect on the output of CBMC and in the current
state only be used by projects which rely on it.

There are several STL-specific simplification routines integrated in the
conversion, e.g. changing the conversion order of operands to avoid
unnecessary nesting.
2019-07-30 17:01:21 +01:00
Hannes Steffenhagen 407c1497ce Add test checking if trace bug in field sensitivity was fixed
The test in this commit checks for a bug in which the initial nondet
assignment to struct fields was missing from --trace (always showing
these struct fields as being initialised to 0).
2019-07-30 13:43:57 +01:00
Daniel Kroening 6b031078c0 fix exprt::opX accesses in analyses
This improves type safety.
2019-07-30 11:34:47 +01:00
Daniel Kroening adceda1f45 fix exprt::opX accesses in goto-symex
This improves type safety.
2019-07-30 10:58:12 +01:00
xbauch b222e5712e Fix source-location init for snapshot-harness
Before we simply took the first instruction with the line number geq to the one
specified. Now we go through all instructions and take the one closest.
2019-07-30 09:43:34 +01:00
xbauch 70bcd951d9 Regression tests for source line input
One where the line exists (there is a goto instruction with that exact line
number) and one where it does not.
2019-07-30 09:42:19 +01:00
Daniel Kroening 9643ec2b45
Merge pull request #4961 from smowton/smowton/cleanup/symex-use-nodiscard
Symex rename functions: use NODISCARD
2019-07-29 19:48:13 +01:00
Chris Smowton e46afa1952 Symex rename functions: use NODISCARD
These used to have side-effects on their parameters, and will still compile if used that
way, so let's use NODISCARD to enforce that their new return value is consulted when
necessary.
2019-07-29 17:37:47 +01:00
owen-jones-diffblue 7dd88998c0
Merge pull request #4875 from owen-jones-diffblue/owen/replace-backtick-with-single-quote
Replace `<stuff>' with '<stuff>'
2019-07-29 12:48:59 +01:00
johndumbell 6642d127e6 Stop sharing removal on refine-strings expression walk
When string refinement was walking a tree it broke all sharing as it
went due to requesting a non-constant iterable which makes copies of all
 elements within it before returning. This causes memory problems
 depending upon size of expressions that are then created - more
 complicated the program and string expressions, the worse this got.
2019-07-29 10:38:25 +01:00
Owen 4c900d1bf8 Do not quote classes we fail to load
The error message used to be
  failed to load class 'Test'
This commit makes it
  failed to load class Test
The reasoning is that there is no need to quote the class name, it is
totally clear where it starts and where it ends.
2019-07-29 10:28:44 +01:00
Owen f0c015193a Remove erroneous backtick 2019-07-29 10:28:44 +01:00
Owen c4cd7aeca6 Do not use backtick as opening single quote
Replace it with '. For example, This changes an error message from
failed to load class `java.nio.file.Path'
to
failed to load class 'java.nio.file.Path'

The reason is that the convention of using ` for opening single
quotes looks odd in most modern fonts. For more discussion please
read:

https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
2019-07-29 10:28:44 +01:00
Łukasz A.J. Wrona 306697d696
Merge pull request #4951 from LAJW/lajw/read_u2
java_bytecode tweaks
2019-07-26 17:38:27 +01:00
Lukasz A.J. Wrona 8d3559bba0 Skip the first iteration of the loop with next() rather than with an if
Cannot use for_each/ranged-for because loop performs a pairwise operation
2019-07-26 16:40:17 +01:00
Lukasz A.J. Wrona 8e573ce9b2 Use for-each instead of for w/ iterators
Skip first iteration with next
2019-07-26 16:40:16 +01:00
Lukasz A.J. Wrona 722649cab0 Remove unnecessary macro 2019-07-26 16:40:16 +01:00
Lukasz A.J. Wrona 5be5e66ed9 Inline std::vector<instructiont> 2019-07-26 16:40:16 +01:00
Lukasz A.J. Wrona 13fb92042c Remove unused usings 2019-07-26 16:40:16 +01:00
Lukasz A.J. Wrona 09f0222dbe Inline annotationst 2019-07-26 16:40:15 +01:00
Lukasz A.J. Wrona 569f3acaab Inline std::vector<u2> 2019-07-26 16:40:15 +01:00
Lukasz A.J. Wrona 89ecf46571 Use reference wrappers instead of iterators to use for-each loop 2019-07-26 16:40:15 +01:00
Lukasz A.J. Wrona ea61cde8fc Use for-each loops instead of iterator-based ones where possible 2019-07-26 16:40:15 +01:00
Lukasz A.J. Wrona de0cbcbd37 Inline one-off using usage
And use auto everywhere else, in accordance with coding guidelines
2019-07-26 16:40:14 +01:00
Lukasz A.J. Wrona f0c39b594a Replace typedef with using
Because this is what our coding standard says so now
2019-07-26 16:40:14 +01:00
Lukasz A.J. Wrona 492b17e237 Make all but the public members private 2019-07-26 16:40:14 +01:00
Lukasz A.J. Wrona 74305df133 mark the class final 2019-07-26 16:40:14 +01:00
Lukasz A.J. Wrona 74bd64c49c Change protected to private section 2019-07-26 16:40:14 +01:00
Lukasz A.J. Wrona 7ae05c3e42 Add override to the overridden method 2019-07-26 16:40:09 +01:00
Daniel Kroening 1aefd22769
Merge pull request #4917 from smowton/smowton/cleanup/rename-lhs-rvalues-up-front-on-develop
Rename LHS rvalues up front
2019-07-26 16:39:27 +01:00
Lukasz A.J. Wrona ae9aaf5687 Use default property values rather than declaring a default constructor 2019-07-26 16:39:20 +01:00
Lukasz A.J. Wrona 5d65b66155 Add const where read was used 2019-07-26 16:39:20 +01:00
Lukasz A.J. Wrona dbecda87da Rename read_bytes to read, inline 2019-07-26 16:39:19 +01:00
Lukasz A.J. Wrona fee9f333e1 Make read_bytes less likely to be called incorrectly
By requiring the user to provide the type we can get byte count from
the provided type, not as an argument, which allowed size to be
incorrectly specified
2019-07-26 16:38:38 +01:00
Matthias Weiss ae6dd2f454 Add support for STL NOT instruction
Extends the language subset of Statement List by the NOT instruction,
used for simply negating the current state of the rlo.
2019-07-26 14:50:05 +01:00
Daniel Poetzl 103b2dccd9
Merge pull request #4939 from yumibagge/yb/jbmc-regression-tg-8284
Add regression tests for [TG-8284]
2019-07-26 12:14:14 +01:00
Yumi Bagge 5352996202 Add a test to check verification failure 2019-07-26 10:44:55 +01:00
Yumi Bagge bb28bf80be Add a regression test with Character type 2019-07-26 10:44:55 +01:00
Yumi Bagge 09724a8a89 Add a regression test that uses models-library 2019-07-26 10:44:55 +01:00
Yumi Bagge c33a1dc487 Clang-format original regression tests 2019-07-26 10:44:55 +01:00
Yumi Bagge 01801138ab Rename folder name more descriptive 2019-07-26 10:44:55 +01:00
Lukasz A.J. Wrona 7dcd04d95d Reformat read_bytes 2019-07-26 09:59:27 +01:00
Chris Smowton 455e8f977f
Merge pull request #4949 from smowton/smowton/feature/more-accurate-member-deref
Simplify and apply field sensitivity before value-set-deref
2019-07-25 18:59:45 +02:00
Chris Smowton 8ff892778d Simplify and apply field sensitivity before value-set-deref
This means that any member-of-symbol constructs introduced by a nested dereference,
such as x->y ==> (x == &o1 ? o1 : o2).y, can be simplified to produce e.g.
(x == &o1 ? o1.y : o2.y) ==> (x == &o1 ? o1..y : o2..y). value_set_dereferencet will
then special-case the if-expression, dereferencing the inner o1..y and o2..y individually.
In the best case where each has a single possible alias, &o3 and &o4 respectively, we
end up with (x == &o1 ? &o3 : &o4), rather than the current result:
let p = (x == &o1 ? o1 : o2).y in (p == &o3 ? o3 : o4)
2019-07-25 15:24:13 +01:00
Peter Schrammel 91ccdfb9a9
Merge pull request #4943 from peterschrammel/non-existing-entry-point
Error message when entry function body cannot be produced [TG-8299]
2019-07-25 10:12:59 +01:00
Chris Smowton c4bc80029d Remove now-unnecessary expr_skeletont methods
These are unused now that we don't have shift_indexed_access_to_lhs or rewrite_with_to_field_symbols
2019-07-25 09:18:14 +01:00
Chris Smowton c529e7e01e Remove unused shift_indexed_access_to_lhs and rewrite_with_to_field_symbols 2019-07-25 09:18:14 +01:00
Chris Smowton 4d1f9ca02c Symex: rename LHS rvalue components and simplify before symex_assign_rec
This was already happening in most cases (e.g. symex_dereference would apply field-sensitivity
before symex_assign_rec was entered), but the case of a statically non-constant but dynamically
constant array index or byte-extract offset would only be handled *after* symex_assign_rec, leading
to an asymmetry in which operations were combined into the ssa_exprt and which ones accumulated in
the expr_skeletont.

With this change the LHS expression is maximally renamed and simplified before symex_assign_rec is
entered, which means that any field-sensitive symbols on the LHS are fully constructed as early as
possible, and expr_skeletont only accumulates those member, index and byte-extract operations which
*cannot* be associated with an ssa_exprt. This means there is no need to undo with-operations or
try to simplify byte-extract operations in goto_symext::assign_from_non_struct_symbol, as this has
been taken care of already, and the l2_full_lhs can be constructed from the expression skeleton
trivially.
2019-07-25 09:18:14 +01:00
Chris Smowton e5e026d201 Implement l2_rename_rvalues(lvalue)
This renames the rvalue components of an lvalue expression to L2, such as the index of an array
expression or the offset involved in byte-extract operation. Lvalue components (e.g. symbols) are
left alone.
2019-07-25 09:18:14 +01:00
Chris Smowton 7932fdd64b Factor out is_read_only_object function 2019-07-25 09:18:14 +01:00