Commit Graph

20015 Commits

Author SHA1 Message Date
svorenova 85a1e8b3bc Move and reuse source_location.function
If the assignment to the method.source_location.function is done first,
we can reuse it when assigning instruction.source_location.function
2019-07-12 11:47:32 +01:00
svorenova 07587bceb4 Remove unnecessary check
If the vector is empty, std:find_if returns end
2019-07-12 11:47:32 +01:00
svorenova 8df4a6b20f Add regression test for Kotlin 2019-07-11 16:39:58 +01:00
svorenova bffa37f9f7 Update regression tests
Not-null annotation check properties which are added to the beginning of
the method's goto inherit the source_locationt of the method. Because
previously the location had missing information (missing method name),
the property name looked like this:
[not-null-annotation-check.1]

Now the name looks like this:
[java::Main.bar:(Ljava/lang/Integer;ZLjava/lang/Object;[Ljava/lang/String;)Ljava/lang/Integer;.not-null-annotation-check.1]
2019-07-11 16:39:17 +01:00
svorenova e240abb783 Update method source location info
The line number is not the line number of the first instruction because
that can be unassigned. Instead, set it to the line number of the first
instruction that does have a line number assigned.

Set location function to be the name of the method itself.
2019-07-11 16:00:10 +01:00
Daniel Poetzl 16f63e8c45
Merge pull request #4781 from danpoe/feature/simplify-expression-index-of
[TG-8284] Expression simplification for indexOf()
2019-07-11 13:11:02 +01:00
Romain Brenguier 1e5fd65072
Merge pull request #4873 from romainbrenguier/bugfix/java-convert-variable
Avoid unnecessary typecast in java_bytecode_convert_methodt::variable
2019-07-11 13:04:11 +01:00
Matthias Weiss 153618e836 Add STL var type marker
Adds a property to each variable declaration so that their type (e.g.
input or output) can be distinguished.
2019-07-11 11:51:05 +01:00
Matthias Weiss c020ea729f Allow empty STL network list
The grammar supports blocks without any content.
2019-07-11 11:51:05 +01:00
Matthias Weiss e890c182fc Change Statement List identifier token
Underscores are allowed inside of identifiers without quotes as long as
they're not the first symbol.
2019-07-11 11:51:05 +01:00
Daniel Poetzl 7b7d526bcc Also check type in can_cast_expr<refined_string_exprt>(expr)
Also check that expr.type() is a refined string type
2019-07-11 11:44:11 +01:00
Daniel Poetzl 5d04804592 Implement simplify_expr() for indexOf() 2019-07-11 11:44:11 +01:00
Romain Brenguier 1c93adbab2 Unit test for convert_store
This function was not directly tested.
2019-07-11 06:40:22 +01:00
Romain Brenguier c8c259dd95 Remove useless check for typecast
We no longer need this cast, as `variable` now returns the expression
with its correct type.
2019-07-11 06:40:22 +01:00
Romain Brenguier faa8f42ac9 Unit test convert_load
Test the behaviour of the method on different type of inputs.
2019-07-11 06:40:18 +01:00
Romain Brenguier e1f901f59d Get rid of t variable in java bytecode convert variable
This is only used once and the name does not give any information.
Also refactor a bit the else branch to simplify the function.
2019-07-10 20:44:47 +01:00
Romain Brenguier f057825699 Make convert_load match its documentation
Rather than typecasting as needed, we check that the type corresponds to
the instruction.
In particular this removes the casting of reference to void reference in
the case of `a`.
2019-07-10 20:44:46 +01:00
Romain Brenguier 83f29c9a47 Extract a convert_load function form convert_instructions
This is similar to how other instructions are handled, makes the
convert_instructions method shorter and gives a natural place where to
document the conversion of the load instruction.
2019-07-10 20:44:46 +01:00
Romain Brenguier cc66ef5115 Unit test java_bytecode_convert_methodt::variable
This method was not directly tested.
This illustrates the fact that we do not typecast from reference of
array[int] to reference of void.
2019-07-10 20:44:43 +01:00
Daniel Kroening cbef420de7
Merge pull request #4888 from diffblue/root_object_opX
better typing in object_descriptor_exprt::root_object()
2019-07-10 11:58:29 +01:00
Romain Brenguier b16cb9adc6 Let caller of variable do typecast if needed
The variable method is mostly called with NO_CAST so it is simpler to
let the caller do the typecast in the rare case they need it.
2019-07-10 10:09:22 +01:00
Peter Schrammel 6dc222f206
Merge pull request #4828 from peterschrammel/context-limiting
Introduce --context-include/exclude options
2019-07-10 09:32:18 +01:00
Daniel Kroening 54a1c67c40 better typing in object_descriptor_exprt::root_object()
This improves memory safety.
2019-07-10 08:50:53 +01:00
Pascal Kesseli d5b0b240e3
Merge pull request #4867 from MatWise/feature/stl-arithmetic-verification
STL Frontend: Full verification of arithmetic instructions
2019-07-09 17:11:32 +02:00
Romain Brenguier 5c5bf5cc80
Merge pull request #4887 from romainbrenguier/bugfix/evaluate-pointer-comparisons
Skip typecast when trying to evaluate pointer comparisons
2019-07-09 15:38:48 +01:00
Romain Brenguier 3eb067a380 Add test for enum equality
In particular the test with typecast could fail because of a bug in
try_evaluate_pointer_comparisons when the rhs had a typecast.
2019-07-09 14:21:17 +01:00
Romain Brenguier cdc9a9b543 Reorganize JBMC Enum tests
Group them in the same folder and avoid duplication to make it easier
to find whether a feature is tested.
2019-07-09 14:21:11 +01:00
Romain Brenguier b40087b7ab Test try_evaluate_pointer_comparisons with typecasts
This case was not tested, and needs to be handled carefully by the
function.
2019-07-09 14:20:55 +01:00
jeannielynnmoulton c981376051
Merge pull request #4886 from jeannielynnmoulton/jeannie/UpdateBugReference
Add bug reference to desc file.
2019-07-09 14:20:46 +01:00
Romain Brenguier 5b409d1a17 Skip typecast in try_evaluate_pointer_comparison
Leaving typecast in the expression could lead to erroneous result.
For instance (A*)(B*)dynamic_object would have been considered different
from (A*)dynamic_object while they are the same pointer.
2019-07-09 14:20:34 +01:00
Matthias Weiss 4625edefc3 Add regression tests for arithmetic STL instructions
Includes tests for verifying all arithmetic instructions that are
implemented by this date.
2019-07-09 13:52:10 +01:00
Matthias Weiss eabe6b6f1e Add support for STL arithmetic comparison instructions
List of new instructions:
==I (equality for Int)
<>I (inequality for Int)
<I (less than for Int)
>I (greater than for Int)
<=I (less than or equal for Int)
>=I (greater than or equal for Int)
==D (equality for DInt)
<>D (inequality for DInt)
<D (less than for DInt)
>D (greater than for DInt)
<=D (less than or equal for DInt)
>=D (greater than or equal for DInt)
==R (equality for Real)
<>R (inequality for Real)
<R (less than for Real)
>R (greater than for Real)
<=R (less than or equal for Real)
>=R (greater than or equal for Real)
2019-07-09 13:52:10 +01:00
Matthias Weiss 2ec46f9ba8 Change order of operands for arithmetic STL instructions
ACCU1 being rhs and ACCU2 being lhs is the right (yet counter-intuitive)
order of operands according to the Siemens documentation.
2019-07-09 13:52:10 +01:00
Matthias Weiss 4ac7ba6c39 Support constants by STL LOAD instruction
Adds the ability to push constants on the accumulator and to use them in
arithmetic operations (was symbols only).
2019-07-09 13:52:10 +01:00
Matthias Weiss 7f1b74843e Add __CPROVER_rounding_mode for STL
Provides a function for generating the __CPROVER_rounding_mode symbol
and for initializing it inside of __CPROVER_initialize. Currently only
uses the ROUND_TO_EVEN rounding mode.
2019-07-09 13:52:10 +01:00
Matthias Weiss 8ca23bab8a Adjust Statement List constant and version parsing
Adds an extra state to the scanner to distinguish the version from
regular floats. Also adjusts the literal converters so that they use
utility functions for the conversion from the primitive type to its irep
representation. This ensures compatibility with the GOTO conversion
process later.
2019-07-09 13:52:10 +01:00
Pascal Kesseli 485ddbdaaa
Merge pull request #4820 from MatWise/feature/statement-list-typecheck
STL frontend: Typecheck
2019-07-09 11:45:05 +02:00
Jeannie Moulton ce53697bb5 Add bug reference to desc file.
TG-8355
2019-07-09 10:29:05 +01:00
jeannielynnmoulton c24ff8a444
Merge pull request #4868 from jeannielynnmoulton/jeannie/CharacterPrintable
--string-printable option also forces chars to be printable
2019-07-09 10:13:51 +01:00
Peter Schrammel 836042f255
Merge pull request #4880 from diffblue/stl-codeowners
STL code owners
2019-07-08 17:55:49 +01:00
Pascal Kesseli 3d620ecdd6 STL code owners
Define code owners for `src/statement-list`.
2019-07-08 16:14:22 +02:00
thomasspriggs 7051df5fe2
Merge pull request #4855 from thomasspriggs/tas/iot
Add `code_inputt` and `code_outputt` for `ID_input` and `ID_output`
2019-07-08 15:11:10 +01:00
Jeannie Moulton 27f2894fb2 Make more general interval_constraint function in util.
It is undesirable to have dependencies on the string solver, so
char_printable_constraintss has been moved into util and made more general.
2019-07-08 14:23:31 +01:00
Jeannie Moulton 92ecc4e592 Add tests for static char fields
For --string-printable and --nondet-static, we expect that static char
fields will not be able to produce a counterexample to violated the
assumption that the character is printable.
2019-07-08 14:20:39 +01:00
Jeannie Moulton 59edcd1e52 Add FUTURE regression tests for char arrays and string-printable
In order to implement this constraint for arrays, we would have to do a
loop even though the element type is primitive. This was deemed to
costly in terms of time for the benefit at the time of implementation.
2019-07-08 14:20:39 +01:00
Jeannie Moulton 6f0844c8df Add regression tests for JBMC to show effect of string-printable on char
--string-printable now affects nondet characters, so we add regression
tests to show that the assertion that the character is in the printable
set cannot be violated when --string-printable is enabled and that it
can be when --string-printable is not enabled.
2019-07-08 14:20:39 +01:00
Jeannie Moulton 3deddf80d5 Unit tests for char_set_restrictions
For a representative character set, test that the resulting expression is of the
form expected.
2019-07-08 14:20:37 +01:00
Daniel Kroening 90a835513e set the name of bison-generated header file
This avoids the need to rename the header file in the Makefile.
2019-07-08 14:09:58 +01:00
Thomas Spriggs 061761898a Add `code_outputt` class to wrap around `ID_output` based ireps
This commit adds a higher level interface for `ID_output` based ireps.
This gives us a central place to document instances of these and a
central place to put the code for constructing and checking them. This
makes it possible to find documentation about them and avoids
duplicating the code for constructing and checking them.
2019-07-08 13:12:19 +01:00
Thomas Spriggs 584e6c0170 Add `code_inputt` class to wrap around `ID_input` based ireps
This commit adds a higher level interface for `ID_input` based ireps.
This gives us a central place to document instances of these and a
central place to put the code for constructing and checking them. This
makes it possible to find documentation about them and avoids
duplicating the code for constructing and checking them.
2019-07-08 13:12:19 +01:00