Skip to content

Commit fadb25a

Browse files
Add a version of static_verifier that works with propertiest
This will make it easier to use with static_verifiert going forward.
1 parent e36c5f1 commit fadb25a

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

src/goto-analyzer/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ target_link_libraries(goto-analyzer-lib
1212
cpp
1313
linking
1414
big-int
15+
goto-checker
1516
goto-programs
1617
analyses
1718
pointer-analysis

src/goto-analyzer/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ OBJ += ../ansi-c/ansi-c$(LIBEXT) \
1313
../cpp/cpp$(LIBEXT) \
1414
../linking/linking$(LIBEXT) \
1515
../big-int/big-int$(LIBEXT) \
16+
../goto-checker/goto-checker$(LIBEXT) \
1617
../goto-programs/goto-programs$(LIBEXT) \
1718
../analyses/analyses$(LIBEXT) \
1819
../pointer-analysis/pointer-analysis$(LIBEXT) \

src/goto-analyzer/module_dependencies.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ analyses
33
assembler
44
cpp
55
goto-analyzer
6+
goto-checker
67
goto-programs
78
java_bytecode # will go away
89
langapi # should go away

src/goto-analyzer/static_verifier.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,39 @@ struct static_verifier_resultt
2727
irep_idt function_id;
2828
};
2929

30+
void static_verifier(
31+
const abstract_goto_modelt &abstract_goto_model,
32+
const ai_baset &ai,
33+
propertiest &properties)
34+
{
35+
auto const ns = namespacet{abstract_goto_model.get_symbol_table()};
36+
for(auto &property : properties)
37+
{
38+
auto &property_status = property.second.status;
39+
auto const &property_location = property.second.pc;
40+
auto condition = property_location->get_condition();
41+
auto const predecessor = ai.abstract_state_before(property_location);
42+
auto const &domain = *predecessor;
43+
domain.ai_simplify(condition, ns);
44+
if(condition.is_true())
45+
{
46+
property_status = property_statust::PASS;
47+
}
48+
else if(condition.is_false())
49+
{
50+
property_status = property_statust::FAIL;
51+
}
52+
else if(domain.is_bottom())
53+
{
54+
property_status = property_statust::NOT_REACHABLE;
55+
}
56+
else
57+
{
58+
property_status = property_statust::UNKNOWN;
59+
}
60+
}
61+
}
62+
3063
/// Makes a status message string from a status.
3164
static const char *message(const static_verifier_resultt::statust &status)
3265
{

src/goto-analyzer/static_verifier.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Author: Martin Brain, martin.brain@cs.ox.ac.uk
99
#ifndef CPROVER_GOTO_ANALYZER_STATIC_VERIFIER_H
1010
#define CPROVER_GOTO_ANALYZER_STATIC_VERIFIER_H
1111

12+
#include <goto-checker/properties.h>
13+
#include <goto-programs/abstract_goto_model.h>
1214
#include <iosfwd>
1315

1416
class ai_baset;
@@ -23,4 +25,9 @@ bool static_verifier(
2325
message_handlert &,
2426
std::ostream &);
2527

28+
void static_verifier(
29+
const abstract_goto_modelt &abstract_goto_model,
30+
const ai_baset &ai,
31+
propertiest &properties);
32+
2633
#endif // CPROVER_GOTO_ANALYZER_STATIC_VERIFIER_H

0 commit comments

Comments
 (0)