Skip to content

Fix for getting values of pointers in traces in new SMT backend #6831

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
merged 4 commits into from
Apr 27, 2022

Conversation

NlightNFotis
Copy link
Contributor

This PR changes the code that constructs bit vector terms from solver
values so that it now supports pointers.

This allows us to now see pointer values in traces in the new SMT backend.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

^EXIT=10$
^SIGNAL=0$
--
--
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Missing test description - "Test printing of NULL pointer values in trace."

@@ -44,7 +44,7 @@ class value_expr_from_smt_factoryt : public smt_term_const_downcast_visitort
{
INVARIANT(
pointer_type->get_width() == sort_width,
"Width of smt bit vector term must match the width of pointer type.");
"Width of smt bit vector term must match the width of pointer type.");
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ This change appears to have been squashed into the wrong commit.

rowt{
smt_bit_vector_constant_termt{12, 64},
constant_exprt(
integer2bvrep(12, 64), pointer_typet(unsignedbv_typet(64), 64))},
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 It could be a bit tidier if these pointer tests were separated out into a macro like for the BIT_VECTOR_TESTS.
💡 These tests could be made more thorough by re-running them for 32 and 64 bit pointer widths.
💡 Using a pointer to a type such as bool_typet or void_type() instead of a pointer to unsignedbv_typet(64), may help improve the readability of the test by making all instances of the number 64 relate to the width of the pointer, rather than the width of the type the pointer points to.

}
else
{
// The reason we are mnually constructing a constant_exprt here is a
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Typo "mnually" should be "manually"

@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #6831 (09cc397) into develop (cd4139b) will increase coverage by 0.01%.
The diff coverage is 79.35%.

❗ Current head 09cc397 differs from pull request most recent head 691a3df. Consider uploading reports for the commit 691a3df to get more accurate results

@@             Coverage Diff             @@
##           develop    #6831      +/-   ##
===========================================
+ Coverage    77.01%   77.03%   +0.01%     
===========================================
  Files         1594     1594              
  Lines       184954   185016      +62     
===========================================
+ Hits        142438   142520      +82     
+ Misses       42516    42496      -20     
Impacted Files Coverage Δ
src/goto-instrument/contracts/contracts.h 100.00% <ø> (ø)
...nstrument/contracts/havoc_assigns_clause_targets.h 100.00% <ø> (ø)
src/util/pointer_expr.h 87.83% <ø> (ø)
src/util/replace_symbol.h 100.00% <ø> (ø)
...smt2_incremental/construct_value_expr_from_smt.cpp 100.00% <ø> (ø)
src/goto-instrument/contracts/utils.h 83.92% <70.00%> (+0.90%) ⬆️
src/goto-instrument/horn_encoding.cpp 72.27% <72.22%> (ø)
src/ansi-c/c_typecheck_code.cpp 80.03% <90.90%> (+0.11%) ⬆️
src/util/replace_symbol.cpp 88.29% <91.30%> (ø)
src/goto-instrument/contracts/contracts.cpp 94.48% <100.00%> (ø)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5ce4e5...691a3df. Read the comment docs.

NlightNFotis and others added 4 commits April 27, 2022 16:17
…ew SMT backend.

The difference is that the previous test was effectively exercising NULL and any
other pointer value (1, for instance) whereas this one specifically matches the
decimal value of 0xDEADBEEF.
@NlightNFotis NlightNFotis force-pushed the pointer_val_in_trace_fix branch from 09cc397 to 691a3df Compare April 27, 2022 15:28
@NlightNFotis NlightNFotis merged commit e3dd810 into diffblue:develop Apr 27, 2022
@NlightNFotis NlightNFotis deleted the pointer_val_in_trace_fix branch April 27, 2022 16:46
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.

3 participants