Skip to content

Account for replaced functions in exceptions_map #1375

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 1 commit into from
Sep 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions regression/cbmc-java/exceptions25/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
int main(void)
{
int x;
__CPROVER_assume(x < 10);
__CPROVER_assert(x != 0, "");
return 0;
}
14 changes: 14 additions & 0 deletions regression/cbmc-java/exceptions25/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CORE
main.c

^EXIT=10$
^SIGNAL=0$
VERIFICATION FAILED
--
^warning: ignoring
--
When compiling CBMC with -DDEBUG uncaught exception analysis prints an
exceptions map per function. This test ensures that meta-functions which are
replaced by explicit GOTO instructions (e.g. __CPROVER_assert, __CPROVER_assume)
and thus do not occur as explicit function calls in the final GOTO program are
handled correctly.
8 changes: 5 additions & 3 deletions src/analyses/uncaught_exceptions_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,11 @@ void uncaught_exceptions_analysist::output(
{
const auto fn=it->first;
const exceptions_mapt::const_iterator found=exceptions_map.find(fn);
INVARIANT(
found!=exceptions_map.end(),
"each function expected to be recorded in `exceptions_map`");
// Functions like __CPROVER_assert and __CPROVER_assume are replaced by
// explicit GOTO instructions and will not show up in exceptions_map.
if(found==exceptions_map.end())
continue;

const auto &fs=found->second;
if(!fs.empty())
{
Expand Down