Skip to content

Conversation

martin-cs
Copy link
Collaborator

As I noted last time #6187 (comment) if one of the images that doesn't use the SMT back-end also doesn't have Z3 on the path then these bugs will manifest on PR and I won't need to keep patching them.

@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #6244 (3493061) into develop (ccfbaee) will decrease coverage by 0.01%.
The diff coverage is 79.77%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6244      +/-   ##
===========================================
- Coverage    76.18%   76.16%   -0.02%     
===========================================
  Files         1484     1484              
  Lines       162092   162173      +81     
===========================================
+ Hits        123495   123525      +30     
- Misses       38597    38648      +51     
Impacted Files Coverage Δ
src/analyses/custom_bitvector_analysis.cpp 54.97% <0.00%> (ø)
src/analyses/escape_analysis.cpp 64.15% <0.00%> (ø)
src/analyses/global_may_alias.cpp 0.00% <0.00%> (ø)
src/analyses/interval_domain.cpp 59.03% <0.00%> (ø)
src/analyses/local_bitvector_analysis.cpp 75.14% <ø> (ø)
src/analyses/local_may_alias.cpp 61.18% <ø> (ø)
src/analyses/local_safe_pointers.cpp 81.55% <ø> (ø)
src/analyses/uncaught_exceptions_analysis.cpp 92.77% <ø> (ø)
...ses/variable-sensitivity/abstract_pointer_object.h 0.00% <ø> (-100.00%) ⬇️
...ble-sensitivity/constant_pointer_abstract_object.h 100.00% <ø> (ø)
... and 48 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 9509685...3493061. Read the comment docs.

Comment on lines 1 to 3
CORE smt-backend broken-cprover-smt-backend
main.c
--apply-loop-contracts _ --z3
--apply-loop-contracts _
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the tag to mark this is broken for the cprover backend, but removing the --z3 tag hides that this uses functionality explicit to z3. I know the default at the moment is z3, but leaving this explicit has clarity that I'm not sure we want to remove.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unless I have radically misunderstood, this should work with any SMT solver that supports quantifiers. I will re-add --z3 but this means that the smt-backend tests will fail if another solver is used and z3 is not present.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not for this specific example, but a lot of the quantified output is a problem for other solvers. Typically cvc3 and cvc4 will error out due to quantifiers while specifying quantifier free logic, similar behaviour for mathsat and boolector. I think only z3 can handle it out of the box from cbmc, while modifying the set-logic command allows cvc4 to handle it (but can produce unknowns... which we were avoiding until it became clear this happens for z3 and is now handled gracefully). Also in the current backend the output for z3 is different to most other solvers, so turning of the --z3 flag may reveal different SMT code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

due to quantifiers while specifying quantifier free logic

This is the intended and correct behaviour of the solver.

but can produce unknowns... which we were avoiding until it became clear this happens for z3 and is now handled gracefully

Again, if the logic you have requested / fragment of logic you have used is undecideable, this is intended behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies if my comment was unclear. I was not implying the behaviour was incorrect, only commenting on what we see now (and why I think being explicit on z3 is helpful). No requested change or displeasure with the PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry about the late response on this, and for reopening this conversation.

I guess, until #6248 is merged, we could keep the _ --z3 arguments, but it doesn't really matter for the CI because we don't run CVC4 anyway and so this test wouldn't really break anything (without the _ --z3 part).
It would be nice to aim for solver-agnostic SMT encoding for as many cases as possible, and I think in this case we do get a solver-agnostic encoding that should work with both Z3 and CVC4 (modulo the set-logic issue). To me, _ --z3 indicates that this test triggers some Z3-specific encoding that wouldn't work on other SMT solvers in general.

Moreover, if that's the case, we should use the broken-<solver-X>-backend tags to explicitly document that at least for Z3, CVC4 and CPROVER SMT2 solvers.

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TBH for the purposes of this test all I want is to be able to run the regression tests on a machine that doesn't have Z3 installed. For me anything else is a discussion for another ticket / issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Approving this and unblocking you. We can revisit this issue once #6248 is merged may be.

@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 3fa50ec to 8f21822 Compare July 22, 2021 11:13
Copy link
Contributor

@SaswatPadhi SaswatPadhi left a comment

Choose a reason for hiding this comment

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

Thanks for these changes. LGTM, but a couple of questions below:

- be tagged `smt-backend`:
because the SAT backend does not support (simply ignores) `forall` in negative (e.g. assume) contexts.
- be tagged `broken-cprover-smt-backend`:
because the CPROVER SMT2 solver cannot handle (errors out on) `forall` in negative (e.g. assume) contexts.
- not use the `_ --z3` parameters:
Copy link
Contributor

@SaswatPadhi SaswatPadhi Jul 22, 2021

Choose a reason for hiding this comment

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

Do we still need the _ --z3, now that you have added Makefile rules to handle SMT-related tags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See @TGWDB 's request above.

@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 8f21822 to 77c5d5d Compare July 27, 2021 09:58
@martin-cs
Copy link
Collaborator Author

@SaswatPadhi @TGWDB please could you re-review? @feliperodri please coul you have a look as a maintainer for code contracts? I would like to get this merged ASAP.

@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 166b3cf to 64151c2 Compare July 27, 2021 11:17
@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 64151c2 to 266b1b5 Compare July 27, 2021 16:29
@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 266b1b5 to 76f736c Compare July 27, 2021 21:08
These cause a substantial increase in regression run time and so are
disabled for now.
@martin-cs martin-cs force-pushed the fix/tag-z3-regression-tests-3 branch from 76f736c to 3493061 Compare July 27, 2021 21:10
@martin-cs
Copy link
Collaborator Author

Thanks @SaswatPadhi . I have disabled the CMake SMT solver configurations for now as they were increasing the run time of the regressions by a lot. As discussed above, there may be changes to how the regression tests are run for SMT solvers so I will leave enabling them to be part of that discussion.

@SaswatPadhi
Copy link
Contributor

SaswatPadhi commented Jul 27, 2021

Sounds good. Thanks a lot for adding the SMT tags support to regression/contracts!

@martin-cs martin-cs merged commit c5871d7 into diffblue:develop Jul 27, 2021
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