Skip to content

Commit 33003c0

Browse files
committed
Add missing error handling in smt_piped_solver_processt::send
So that cbmc stops on errors rather than waiting for responses to messages which didn't send later in processing.
1 parent cc9d04e commit 33003c0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/solvers/smt2_incremental/smt_solver_process.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ void smt_piped_solver_processt::send(const smt_commandt &smt_command)
2828
const std::string command_string = smt_to_smt2_string(smt_command);
2929
log.debug() << "Sending command to SMT2 solver - " << command_string
3030
<< messaget::eom;
31-
process.send(command_string + "\n");
31+
const auto response = process.send(command_string + "\n");
32+
switch(response)
33+
{
34+
case piped_processt::send_responset::SUCCEEDED:
35+
return;
36+
case piped_processt::send_responset::FAILED:
37+
throw analysis_exceptiont{"Sending to SMT solver sub process failed."};
38+
case piped_processt::send_responset::ERRORED:
39+
throw analysis_exceptiont{"SMT solver sub process is in error state."};
40+
}
41+
UNREACHABLE;
3242
}
3343

3444
/// Log messages and throw exception.

0 commit comments

Comments
 (0)