Commit Graph

17529 Commits

Author SHA1 Message Date
Romain Brenguier 06776f2b1c Add travis build with NAMED_SUB_FORWARD_LIST
We add this step to check that CBMC compiles fine with this flag, and
run relevant unit tests for irept.
2019-02-14 08:55:02 +00:00
Romain Brenguier 2114ff3424 Extract a non_sharing_treet class from irept
This avoids having #ifdef SHARING and similar preprocessor instruction
in the middle of the code, and only keep one such #ifdef when irept
chooses to inherit from sharing_treet or non_sharing_treet.
This was obtained by extracting from irept, the part of the code which
would only apply when SHARING is not defined.
This results in a simple self contained class, similar to the
sharing_treet class.
2019-02-14 08:55:01 +00:00
Romain Brenguier 008b3a30db Extract a sharing_treet class from irept
The use of macros in the irept class make its difficult to understand
and prevent to use both possibilities in the same compilation.
This commit extracts from the irept class the part of the code that only
exists when SHARING is defined, which results in a simple, self
contained class.
2019-02-14 08:55:01 +00:00
Romain Brenguier beeae65953 Template argument to decide on sharing
This replaces preprocessor instructions, making the code a bit clearer
and the node class more reusable.
In particular we can use both the sharing and non sharing implementation
in the same compiled binary. This will be useful when we separate the
sharing and non sharing implementations of irept.
2019-02-13 15:16:53 +00:00
Romain Brenguier 07118caa8a Untangle dt and irept
We extract the dt class from irept, rename it to tree_nodet and make
the tree type a template argument.
This exposes more clearly how they depend on each other, and makes it
easier to reason about them independently.
In particular we now see that the node doesn't need to know much about
the tree except that it can be stored in the vector or a map.
2019-02-13 15:16:53 +00:00
Michael Tautschnig c0819f936e
Merge pull request #4175 from tautschnig/return-has-an-operand
Return statements always have one operand
2019-02-13 13:57:51 +00:00
Chris Smowton 67f2e0cf8c
Merge pull request #4172 from smowton/smowton/cleanup/generic-unit-test-type-checks
Generic tests: check for matching tag, not completely matching type
2019-02-13 13:16:57 +00:00
Chris Smowton 7b3f0c1331 is_not_zero: ensure equality test has exactly matching types 2019-02-13 12:22:01 +00:00
Michael Tautschnig 512b6b7ed8
Merge pull request #4174 from hannes-steffenhagen-diffblue/regression-add_nullpointer_regression_test
Add KNOWNBUG regression test for GH issue #4168
2019-02-13 12:16:09 +00:00
Chris Smowton ee1a28484f
Merge pull request #4171 from smowton/smowton/fix/string-preprocessor-use-tag-types
String library preprocessor: use tag types, not expanded structs
2019-02-13 12:02:34 +00:00
Michael Tautschnig ac150b58e7 Return statements always have one operand
We already enforced this when creating a code_returnt, but still permitted
codet(ID_return) that did not have the same. Make sure the C parser always
creates irepts with an operand, and make use of that throughout the code base.
2019-02-13 11:57:42 +00:00
Chris Smowton 363d217ef6 Generic tests: check for matching tag, not completely matching type
Previously these relied on base_type_eq to hide differently-decorated tags; now they explicitly
just check the tag name, rather than relying on base_type_eq, which will soon go away anyway, to
hide generic qualifiers and/or array element types.
2019-02-13 11:50:33 +00:00
Hannes Steffenhagen 820fd3559a Add KNOWNBUG regression test for GH issue #4168 2019-02-13 11:19:26 +00:00
Michael Tautschnig 606a83a359
Merge pull request #4144 from diffblue/instructiont-guard
avoid accesses to instructiont::guard
2019-02-13 10:38:34 +00:00
Chris Smowton c4ae7def5e String library preprocessor: use tag types, not expanded structs
Without these we get assignments whose types match according to base_type_eq, but not operator==.
2019-02-13 10:26:23 +00:00
Daniel Kroening d1c27498f1 introduce instructiont::set_condition()
This will eventually allow us to protect the guard data member.
2019-02-13 08:09:48 +00:00
Daniel Kroening ee7cbbd225 introduce instructiont::has_condition()
This will eventually enable use to protect instructiont::guard.
2019-02-13 08:09:11 +00:00
Daniel Kroening 52dad14d5d use instructiont::get_condition()
This will eventually enable use to protect instructiont::guard.
2019-02-13 08:06:59 +00:00
Michael Tautschnig e3ff2464c1
Merge pull request #3890 from diffblue/source-is-not-optional
symex: source is not optional
2019-02-12 19:22:36 +00:00
Chris Smowton 3f0f776cfe
Merge pull request #4137 from smowton/smowton/fix/java-static-field-generic-types
Java frontend: get qualified generic types of static fields
2019-02-12 17:47:55 +00:00
Daniel Kroening 9e0c5a3d51 remove the trivial constructor from symex_targett::sourcet
sourcet contains an interator, and the current interface explicitly allows
it to be uninitialised.  However, most parts of the code base access
source.pc without checking.  This commit removes the option to leave the
source uninitialized.
2019-02-12 17:37:29 +00:00
Michael Tautschnig 4302619a4c Refactor goto_symext initialisation API
Avoid doing the same start_function set-up three times, and avoid redundant work
between different initialize* functions when one always calls the other.
2019-02-12 17:37:23 +00:00
Daniel Kroening 09de169371 Ensure goto_symex_statet::source is always set
sourcet contains an interator, and the interface explicitly allows it to be
uninitialised.  However, most parts of the code base access source.pc
without checking.
2019-02-12 16:45:21 +00:00
Michael Tautschnig 2f1514ee48
Merge pull request #4155 from tautschnig/merge-irept-skip-same
merge_irept: insert once and then const_cast to edit in place
2019-02-12 16:37:29 +00:00
Chris Smowton 35213c49f3 Comment that static field symbols should exist
Avoid the suggestion that `get_static_field` might be expected to create them -- it doesn't,
java_bytecode_convert_class does and we should be able to safely assume they exist
during convert_method.
2019-02-12 16:24:50 +00:00
Chris Smowton b43753a12b
Merge pull request #3966 from tautschnig/reinstate-limited-symex-renaming
Reinstate limited symex renaming [blocks: #4164]
2019-02-12 14:25:51 +00:00
Michael Tautschnig 3b7d59af5f
Merge pull request #4097 from smowton/smowton/admin/clean-and-document-symex-deref
Clean and document symex-dereference
2019-02-12 13:46:31 +00:00
Michael Tautschnig 51ccac845e
Merge pull request #4165 from tautschnig/parametert-api
Use modern API to access parametert's identifier and base name
2019-02-12 13:18:21 +00:00
Michael Tautschnig c76d69abff
Merge pull request #4162 from peterschrammel/fix-trace-truncation
Correctly truncate error traces
2019-02-12 13:00:48 +00:00
Michael Tautschnig 3b95d0a9a9 merge_irept: insert once and then const_cast to edit in place
This avoids multiple lookups in the hash set, each of which requires a number of
operator== and hash() calls. The use of const_cast is acceptable, because we do
not actually change the object in a way that would affect ordering (objects will
continue to have the same hash value and still compare equal).

We furthermore ensure that operator== can use pointer equality when submitting
an already-shared irept to merge_irept. On SV-COMP/ReachSafety-ECA this reduces
the number of recursive operator== invocations from 5,814,764,546 (generated by
4,241,423,614 invocations) to 2,232,563,047 (generated from 4,326,016,698
invocations). That is, despite ~100M additional invocations (because the
performance improvement permits more symbolic execution runs) around 3.6B
recursive calls are avoided.
2019-02-12 12:52:46 +00:00
Michael Tautschnig 94dacc5416 Revert "Revert "Use get_fresh_aux_symbol to create $array_size and fix its type""
This reverts commit 9e204fd543.
2019-02-12 12:38:16 +00:00
Michael Tautschnig bc9233edd6 Revert "clang-format reverted code - must be reverted in future as well"
This reverts commit ea539edd7d.
2019-02-12 12:38:16 +00:00
Michael Tautschnig d9e27b2fbc Revert "Revert "Check all struct members for possible need for renaming""
This reverts commit ec7e041140.
2019-02-12 12:38:16 +00:00
Michael Tautschnig 98e53652eb Revert "Revert "goto_symex: rename type symbols only when needed""
This reverts commit 60ce9975e6.
2019-02-12 12:38:16 +00:00
Chris Smowton d5740b313e
Merge pull request #4161 from smowton/smowton/fix/object-factory-keep-struct-tags
Java object factory: retain tagged types
2019-02-12 12:31:08 +00:00
Chris Smowton a208cce75f Add test for generic static field type consistency 2019-02-12 12:17:32 +00:00
Chris Smowton c7ad88561f Java frontend: get qualified generic types of static fields
Before it would unintentionally erase SomeClass.field from A<B> to just the unqualified A type.
2019-02-12 12:09:50 +00:00
Chris Smowton 115cb7eaed Replace redundant pointer-and-boolean with just a pointer
It's already implicit in a bare pointer (rather than a reference) that it could be null,
so let's just use that to express whether we have an answer or not.
2019-02-12 12:07:40 +00:00
Michael Tautschnig 249002dad0 Use modern API to access parametert's identifier and base name
Whether we store the values at ID_C_identifier/ID_C_base_name or elsewhere is an
implementation detail. Includes code cleanup to use a ranged for, and a bugfix
where ID_arguments was still being used when it should be parameters.
2019-02-12 11:42:13 +00:00
Chris Smowton 328bc04aec Amend generics test to expect tag types rather than plain structs 2019-02-12 11:17:04 +00:00
Chris Smowton 7b17821917 Add unit test verifying that java_object_factory doesn't strip tag types
Previously if asked to populate a pointer with tagged type (e.g. "Object *") then it would
allocate a "struct Object { ... }", i.e. the struct_typet rather than the struct_tag_typet.
This verifies that it now retains tag types.
2019-02-12 11:16:58 +00:00
Peter Schrammel cbd61b2ab8 Test for printing multiple goto traces from one counterexample
The traces need to be correctly truncated so that
the failing property comes last.
The traces are printed in the same order as the properties
are listed in the result report.
2019-02-12 10:49:16 +00:00
Peter Schrammel a6c65e6309 Output traces in same order as properties
which is more readable.
2019-02-12 10:49:16 +00:00
Peter Schrammel 5929aee5b5 Extend goto_trace_provider interface
to support
- full trace for whole SSA
- trace for a specific property
- trace for the "first" failing property (behavior of stop-on-fail)
2019-02-12 10:49:16 +00:00
Peter Schrammel 21ea8fc074 Function for matching SSA step with property ID
to be used in build_goto_trace to truncate traces.
2019-02-12 10:49:16 +00:00
Peter Schrammel b5a482fd97 Helper for building error trace message
Produce message in a single place.
2019-02-12 10:49:16 +00:00
Michael Tautschnig 795cf7fdc8
Merge pull request #4163 from tautschnig/irept-deserialisation
irept deserialisation: avoid unnecessary construct/destruct
2019-02-12 10:14:28 +00:00
Michael Tautschnig 995667e758
Merge pull request #4166 from tautschnig/goto-binary-versioning
Put current goto binary version in a single place
2019-02-12 10:04:53 +00:00
Daniel Kroening 8f8ae2b22a added instructiont::turn_into_skip()
This is an implementation for the common idiom in which an existing
instruction is replaced by a skip while retaining the source_location.  It
replaces instructiont::make_skip().
2019-02-12 09:33:39 +00:00
Michael Tautschnig fa80f58e97 Put current goto binary version in a single place
Updates to the goto binary version should always be consistent, and shouldn't
require changes in multiple places. Also we never support more than one version
at a time.
2019-02-12 09:07:40 +00:00