Skip to content

Commit 6d2b7f9

Browse files
author
thk123
committed
Provide the original goto statement in the error
This required the symex target_equation having the namespace to resolve names
1 parent ed76900 commit 6d2b7f9

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/cbmc/bmc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class bmct:public safety_checkert
8080
options(_options),
8181
outer_symbol_table(outer_symbol_table),
8282
ns(outer_symbol_table, symex_symbol_table),
83-
equation(),
83+
equation(ns),
8484
branch_worklist(_branch_worklist),
8585
symex(_message_handler, outer_symbol_table, equation, branch_worklist),
8686
prop_conv(_prop_conv),

src/goto-instrument/accelerate/scratch_program.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class scratch_programt:public goto_programt
4040
symbol_table(_symbol_table),
4141
symex_symbol_table(),
4242
ns(symbol_table, symex_symbol_table),
43-
equation(),
43+
equation(ns),
4444
branch_worklist(),
4545
symex(mh, symbol_table, equation, branch_worklist),
4646
satcheck(util_make_unique<satcheckt>()),

src/goto-symex/equation_conversion_exceptions.h

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Author: Diffblue Ltd.
1414

1515
#include <ostream>
1616
#include <util/namespace.h>
17+
#include <langapi/language_util.h>
1718
#include "symex_target_equation.h"
1819

1920
class guard_conversion_exceptiont : public std::runtime_error
@@ -26,6 +27,8 @@ class guard_conversion_exceptiont : public std::runtime_error
2627
{
2728
std::ostringstream error_msg;
2829
error_msg << runtime_error::what();
30+
error_msg << "\nSource GOTO statement: "
31+
<< from_expr(ns, "java", step.source.pc->code);
2932
error_msg << "\nStep:\n";
3033
step.output(ns, error_msg);
3134
error_message = error_msg.str();

src/goto-symex/symex_target_equation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ void symex_target_equationt::convert_guards(
439439
}
440440
catch(const bitvector_conversion_exceptiont &conversion_exception)
441441
{
442-
std::throw_with_nested(guard_conversion_exceptiont(step));
442+
std::throw_with_nested(guard_conversion_exceptiont(step, ns));
443443
}
444444
}
445445
}

src/goto-symex/symex_target_equation.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class prop_convt;
3232
class symex_target_equationt:public symex_targett
3333
{
3434
public:
35-
symex_target_equationt() = default;
35+
symex_target_equationt(const namespacet &ns) : ns(ns)
36+
{ }
37+
3638
virtual ~symex_target_equationt() = default;
3739

3840
// read event
@@ -320,6 +322,9 @@ class symex_target_equationt:public symex_targett
320322
// for enforcing sharing in the expressions stored
321323
merge_irept merge_irep;
322324
void merge_ireps(SSA_stept &SSA_step);
325+
326+
private:
327+
const namespacet &ns;
323328
};
324329

325330
inline bool operator<(

0 commit comments

Comments
 (0)