Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already worth investigating why we even end up in this branch. That means that the symbol on the LHS is not in the namespace, which should only be happening if it is a symbol that symex has introduced. Even then that's got a justification for why the
full_lhs_value
should be nil. We've probably got some bug in goto-symex in that case, but I have no idea which one that is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I correct in my understanding of this comment that this invariant should hold for both the branch where the symbol is found and when it is not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that should be the case, yes - and that observation of yours might be the key to resolving this: either it is an invariant, or it should go away completely. For debugging purposes I'd suggest copying this into
symex_target_equationt
to figure out where the invariant is first violated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added in
symex_target_equationt::assignment
the following invariants:And none of them trigger on the failing case (i.e. still see unknown in the trace). Is that what you meant? I can look at the assignment calls to see what these values are, but don't really know what I'd be looking for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thk123 Many thanks, that's good to know. Thus things must be going wrong in
goto-symex/build_goto_trace.cpp
line 344 I'd say. Would you mind inserting an appropriate invariant in there? I think we end up inboolbvt::bv_get_unbounded_array
, which actually does returnnil_exprt
on a couple of branches (but I'm not sure that's a good idea). Actually there are quite a few occurrences ofnil_exprt
insolvers/flattening/boolbv_get.cpp
. I'm not sure anyone of them is a good idea (and the hard-coded100
in line 361 isn't good either). Could you work with @kroening to resolve this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it comes down to:
Which is failing to evaluate the size expr. The reason for this failure is the expression is (rewritten for readability):
Note the constant exprt on the rhs of the if is:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So fixing the underling problem seems hard - the safe_pointers is not able to see through the GOTO:
Obviously this can be fixed by maybe making safe pointers smarter or the front end put the null check nearer, but shouldn't fundamentally a trace still be produced without a fix here? Should
bv_get_unbounded_array
stumble on, looking up the array and disregarding the size? I don't think I have enough insight into the expected behaviour to realistically do this unfortunately.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created #4197 to address the limitations in
bv_get_unbounded_array
. Input, and in particular tests would be very much appreciated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even that shouldn't happen if the correct namespace was used (which at least the new goto-checker implementations should be doing).