Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Give diagnostic in default mode when a root function has call with false precondition and unknown path cond #1184

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

hermanventer
Copy link
Contributor

Description

When an analysis root calls a function with precondition that is know to be false, give a diagnostic about it even when in default mode and with uncertainty about whether the call will be reached or not.

In the test case derived from the repro in issue #1176, the call looks like it is deterministically reachable, but the implementation of vec![1, 2, 3] is sufficiently complicated that the analysis is unable to conclude that no path inside it will crash, which gives it a post condition that is not known to be true, which leaks into the path condition for the call, which ends up as false join true and make this analysis uncertain that the path condition is feasible. The code dealing with false preconditions did not to issue diagnostics in root functions unless the path condition is known to be true. It now issues a diagnostic unless the path condition is known to be false.

Fixes #1176

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • API change with a documentation update
  • Additional test coverage
  • Code cleanup or just keeping up with the latest Rustc nightly

How Has This Been Tested?

./validate.sh with additional test case

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 19, 2022
@codecov
Copy link

codecov bot commented Sep 19, 2022

Codecov Report

Merging #1184 (f65c31f) into main (12d393a) will increase coverage by 0%.
The diff coverage is 100%.

@@          Coverage Diff          @@
##            main   #1184   +/-   ##
=====================================
  Coverage     77%     77%           
=====================================
  Files         23      23           
  Lines      16252   16252           
=====================================
+ Hits       12593   12594    +1     
+ Misses      3659    3658    -1     
Impacted Files Coverage Δ
checker/src/body_visitor.rs 88% <100%> (+<1%) ⬆️
checker/src/call_visitor.rs 81% <100%> (ø)
checker/src/interval_domain.rs 80% <0%> (-1%) ⬇️
checker/src/type_visitor.rs 76% <0%> (+<1%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hermanventer hermanventer merged commit 59eea5e into main Sep 19, 2022
@hermanventer hermanventer deleted the false_precon branch September 19, 2022 02:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag analysis fails on container types
2 participants