MCPcopy Create free account
hub / github.com/AliveToolkit/alive2 / error

Function error

tools/transform.cpp:115–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113using print_var_val_ty = function<void(ostream&, const Model&)>;
114
115static bool error(Errors &errs, State &src_state, State &tgt_state,
116 const Result &r, Solver &solver, const Value *var,
117 const char *msg, bool check_each_var,
118 print_var_val_ty print_var_val) {
119
120 if (r.isInvalid()) {
121 errs.add("Invalid expr", false);
122 return true;
123 }
124
125 if (r.isTimeout()) {
126 errs.add("Timeout", false);
127 return false;
128 }
129
130 if (r.isError()) {
131 errs.add("SMT Error: " + r.getReason(), false);
132 return false;
133 }
134
135 if (r.isSkip()) {
136 errs.add("Skip", false);
137 return true;
138 }
139
140 stringstream s;
141 string empty;
142 auto &var_name = var ? var->getName() : empty;
143
144 {
145 // filter out approximations that don't contribute to the bug
146 // i.e., they don't show up in the SMT model
147 auto &m = r.getModel();
148 set<string> approx;
149 for (auto *v : { &src_state.getApproximations(),
150 &tgt_state.getApproximations() }) {
151 for (auto &[msg, var] : *v) {
152 if (!var || m.hasFnModel(*var) || var->isConst())
153 approx.emplace(msg);
154 }
155 }
156
157 if (!approx.empty()) {
158 s << "Couldn't prove the correctness of the transformation\n"
159 "Alive2 approximated the semantics of the programs and therefore we\n"
160 "cannot conclude whether the bug found is valid or not.\n\n"
161 "Approximations done:\n";
162 for (auto &msg : approx) {
163 s << " - " << msg << '\n';
164 }
165 errs.add(std::move(s).str(), false);
166 return false;
167 }
168 }
169
170 if (config::quiet) {
171 s << msg << " in " << src_state.getFn().getName() << '\n';
172 errs.add(std::move(s).str(), true);

Callers 15

check_refinementFunction · 0.70
execFunction · 0.70
visitUnaryOperatorMethod · 0.50
visitBinaryOperatorMethod · 0.50
visitCastInstMethod · 0.50
visitCallInstMethod · 0.50
visitMemSetInstMethod · 0.50
visitMemTransferInstMethod · 0.50
visitExtractValueInstMethod · 0.50
visitInsertValueInstMethod · 0.50
visitAllocaInstMethod · 0.50

Calls 15

isInvalidMethod · 0.80
isTimeoutMethod · 0.80
isErrorMethod · 0.80
isSkipMethod · 0.80
hasFnModelMethod · 0.80
strMethod · 0.80
isSatMethod · 0.80
isBVMethod · 0.80
uleMethod · 0.80
isLogicalMethod · 0.80
getOffsetMethod · 0.80
getAddressMethod · 0.80

Tested by

no test coverage detected