Skip to content

Conversation

romainbrenguier
Copy link
Contributor

This makes the string solver algorithm work only on finite size arrays. The input program may have pointers and infinite arrays in which case the solver associate finite arrays to them.
The type for the String class in java-bytecode is changed to contain a char pointer instead of a pointer to an infinite array, however infinite array are still present there for non-deterministic assignment.

@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 2 times, most recently from 7148616 to 59fc1bd Compare September 25, 2017 08:02
@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 4 times, most recently from 6371f41 to aca00ce Compare September 25, 2017 10:29
@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch from 330d8da to 4e6fd78 Compare September 26, 2017 09:43
@romainbrenguier romainbrenguier changed the title Complete rework of string solver to avoid using infinite arrays TG-58 Complete rework of string solver to avoid using infinite arrays Sep 26, 2017
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed about a quarter of this. It's just too big. Don't have time to leaf through the rest; suggest finding another reviewer to pick up where I left off, or find a way to split the huge 3000-line commit in the middle of this into stages so each can be reviewed individually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad indentation in this function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indents

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indents

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const typet &?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're expecting this to be a fresh insert, check insert's return value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, check insert's return value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always follow; take return by const ref

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to do this -- jlo is always in the class loader's queue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we have a class loader here (did you see we are in a unit test?)

@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 4 times, most recently from e63e2e9 to 2bf15cd Compare September 27, 2017 09:38
@LAJW LAJW force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 2 times, most recently from 1873cf3 to e34064f Compare September 27, 2017 12:21
Copy link
Contributor

@jasigal jasigal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass, I need to better understand more of the string refinement changes to comment on structure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these appear to be unused.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, there clearly is a usage of optional in the file for example. Question is whether we should start removing headers if they were already included in parent file. Or make some sort of stdafx.h precompiled header file, which would include most commonly used headers (STL utilities, containers, strings, etc.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to go look in CODING_STANDARD.md. It's not completely clear on this type of case, but it does say avoid unnecessary #includes, which they are in the literal sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const & for both

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be deleted, other declaration below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete these added args, they are unneeded in the function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete first two args.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be &.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loop could use expression iterator.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded.

Copy link
Contributor

@LAJW LAJW Sep 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite the opposite.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It wasn't needed.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this by removing unused arguments and updating index_set (and removing current_index set).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be all arrays? It used to just be character arrays. For instance, the skolem functions in not contains constraints are arrays. This code seems to assume the arrays are strings.

@LAJW LAJW force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 3 times, most recently from a7df645 to d8d91e9 Compare September 27, 2017 13:09
@jasigal
Copy link
Contributor

jasigal commented Sep 27, 2017

One thing I think we should address with such a big change to the string refinement process is stop the solver from treating skolem functions as strings. If I run the solver on cbmc/regression/strings-smoke-test/java_contains (so skolem functions from not contains axioms exist), it has its own index set. I have a comment above where any array seems to be treated as a string.

@LAJW LAJW force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch 4 times, most recently from 01e6dd2 to dad57d7 Compare September 27, 2017 14:39
@romainbrenguier
Copy link
Contributor Author

@smowton

or find a way to split the huge 3000-line commit in the middle of this into stages so each can be reviewed individually.

The problem is that it's very difficult to find any significant intermediary stage in this big commit that wouldn't break all the string tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romainbrenguier Changed the behavior of the solver here, probably not on purpose. In a later commit to revert to what was originally there for the most part, but not completely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debugging something with Justing, and this debug output and the one below make this impossible, get is called too often. Please delete.

@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch from 2fa3500 to ef9aeaf Compare September 28, 2017 17:36
Remove duplicate code for add_axioms_for_insert_float.
Style: indentation in add_axioms_for_insert.
Remove useless comment.
Remove unused function: associate_char_array_to_char_pointers.
Rename solver in symbol_resolve.
Rename function in generate_symbol_resolution_from_eq.
Rename function get_char_array_and_concretize.

Documentation update for generate_symbol_resolution, add_lemma,
substitute_function_application, is_char_type.

Some documentation and style fixes.
Debug information for arrays of pointers

Debug information for check_axioms steps

Refactoring: put debug information out of check_axioms

Replace warning by invariant
This is necessary for the negation procedure to know the existential
bounds and unfold the quantification as a conjunction.
This is in the case where super_get does not anything about the array we
give it.
This is necessary so that the string solver returns an array of the
correct size, if the size is the only thing we know about the string.

Add warning message in the case where the symbol is unknown to super_get
This is done by looking at which arrays were associted to pointers in
the generator.
We use this in get to distinguish between strings and arrays of characters
This removes unused functions, declaration of unimplemented function,
unused constants and unused fields.
In initialisation of string objects, this prevents the created objects
from getting out of scope.
The function what was there before was not correct.
It was calling cprover_string_copy which is deprecated.
The check for a specific object number was removed so this does not
check what we want anyway.
It is difficult to make it check the original intended behaviour using
only regular expressions.
This more accurately describe what this object is.
@romainbrenguier romainbrenguier force-pushed the bugfix/char-array-in-java-strings#TG-58#rebase branch from 27c1f83 to 3ee3b25 Compare October 28, 2017 17:44
@romainbrenguier
Copy link
Contributor Author

@peterschrammel I squashed a lot of the correction commits with the corresponding original commit, I don't think there is much more to be done. For the cpp linter failure, this is due to a disagreement with what clang-format does for brackets in lamdbas.

@romainbrenguier
Copy link
Contributor Author

@peterschrammel

How come? The function seems misplaced then.

Would java_utils.cpp be appropriate for this?

Add nolint marker on line with lambdas, which are formatted by clang
in a way that is not compatible with cpp-lint.
@romainbrenguier
Copy link
Contributor Author

This should be replaced by #1539

@peterschrammel peterschrammel merged commit aa94fe8 into diffblue:develop Oct 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants