-
Notifications
You must be signed in to change notification settings - Fork 273
Get lhs_object from byte_extract for goto trace #4480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
peterschrammel
merged 1 commit into
diffblue:develop
from
peterschrammel:byte-extract-lhs-object
Apr 4, 2019
+46
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <assert.h> | ||
#include <stdint.h> | ||
|
||
union myunion { | ||
int64_t i; | ||
double d; | ||
}; | ||
|
||
void test(union myunion u) | ||
{ | ||
u.i += 1; | ||
double d = u.d; | ||
assert(d != 5); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CORE broken-smt-backend | ||
main.c | ||
--xml-ui --function test --little-endian | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
VERIFICATION FAILED | ||
<assignment assignment_type="state" base_name="u" display_name="test::u" hidden="false" identifier="test::u" mode="C" step_nr="\d+" thread="0"> | ||
<location file=".*" function="test" line="\d+" working-directory=".*"/> | ||
<type>union myunion</type> | ||
<full_lhs>byte_extract_little_endian\(u, 0ll?, .*int.*\)</full_lhs> | ||
<full_lhs_value>\d+ll?</full_lhs_value> | ||
<value>\{ \.i=\d+ll? \}</value> | ||
<value_expression> | ||
<union> | ||
<member member_name="i"> | ||
<integer binary="\d+" c_type=".*int.*" width="\d+">\d+</integer> | ||
</member> | ||
</union> | ||
</value_expression> | ||
</assignment> | ||
-- | ||
^warning: ignoring | ||
-- | ||
Tests whether the assignment XML output contains all the required elements | ||
such as identifier, full_lhs, full_lhs_value and value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Remind me, do we actually consider the offset? What you propose is consistent with what's done for index and member expressions, but I'm still wondering whether the overall result is meaningful.
Uh oh!
There was an error while loading. Please reload this page.
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.
No, it was not considered. The meaningfulness is questionable, but that probably goes beyond this fix.
It might be good to actually specify what these fields are supposed to mean precisely.
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.
Here's an example to validate:
The trace currently includes
byte_extract_little_endian(x, 2l, char)=1 (00000001)
- which might not be downstream-consumable, but at least is accurate. If after this PR the result isx=1
then there's a problem I'm afraid.Uh oh!
There was an error while loading. Please reload this page.
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.
goto_trace_steps offer two bits of information:
get_lhs_object()
-- that is the object as defined in the C standard, andx
is the right answer.full_lhs
, which is documented to be "after dereferencing". It is supposed to be exactly what gets assigned. The byte_extract expression above is the best answer for that, in my view.The trace given to the user should show the latter. We may wish to print byte_extract expressions there as a pointer typecast plus dereferencing.
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.
Thank you for clarifying! +1 for printing
byte_extract
as some C expression, which will be important for SV-COMP as well. But I accept that this might be outside the scope of this PR.