Skip to content

Commit af29ee5

Browse files
alexoltean61theo25
andauthored
Callbacks: Fix side-condition events when arity is non-null (#1194)
This PR fixes a bug in calls to calls to `side_condition_event_callback`. Every time such a call should occur, the `rewrite_event_callback` is invoked instead. This is due to a bug in the method that builds substitutions, and calls a callback once the substitution has the required size. Instead of conditionally calling either the rewrite callback or the sidecondition callback, it always calls the rewrite one. This PR fixes the bug. --------- Co-authored-by: Theodoros Kasampalis <[email protected]>
1 parent 790cab9 commit af29ee5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

include/runtime/proof_trace_writer.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ class proof_trace_callback_writer : public proof_trace_writer {
285285
std::optional<rewrite_event_construction> current_rewrite_event_{
286286
std::nullopt};
287287

288+
bool rewrite_callback_pending_;
289+
288290
virtual void proof_trace_header_callback(uint32_t version) { }
289291
virtual void hook_event_callback(call_event_construction const &event) { }
290292
virtual void rewrite_event_callback(rewrite_event_construction const &event) {
@@ -332,6 +334,8 @@ class proof_trace_callback_writer : public proof_trace_writer {
332334
current_rewrite_event_.emplace(ordinal, arity);
333335
if (arity == 0) {
334336
rewrite_event_callback(current_rewrite_event_.value());
337+
} else {
338+
rewrite_callback_pending_ = true;
335339
}
336340
}
337341

@@ -345,7 +349,12 @@ class proof_trace_callback_writer : public proof_trace_writer {
345349
p.second.bits = bits;
346350
size_t new_pos = ++current_rewrite_event_->pos;
347351
if (new_pos == current_rewrite_event_->arity) {
348-
rewrite_event_callback(current_rewrite_event_.value());
352+
if (rewrite_callback_pending_) {
353+
rewrite_event_callback(current_rewrite_event_.value());
354+
rewrite_callback_pending_ = false;
355+
} else {
356+
side_condition_event_callback(current_rewrite_event_.value());
357+
}
349358
}
350359
}
351360

0 commit comments

Comments
 (0)