Skip to content

Commit f066e08

Browse files
Ensure the '$exception_flag' symbol has a valid mode
1 parent e23785d commit f066e08

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/goto-programs/goto_convert_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class goto_convertt:public messaget
335335

336336
typedef std::vector<codet> destructor_stackt;
337337

338-
symbol_exprt exception_flag();
338+
symbol_exprt exception_flag(const irep_idt &mode);
339339
void unwind_destructor_stack(
340340
const source_locationt &,
341341
std::size_t stack_size,

src/goto-programs/goto_convert_exceptions.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void goto_convertt::convert_CPROVER_try_catch(
168168
targets.set_throw(tmp.instructions.begin());
169169

170170
// now put 'catch' code onto destructor stack
171-
code_ifthenelset catch_code(exception_flag(), to_code(code.op1()));
171+
code_ifthenelset catch_code(exception_flag(mode), to_code(code.op1()));
172172
catch_code.add_source_location()=code.source_location();
173173

174174
targets.destructor_stack.push_back(std::move(catch_code));
@@ -194,7 +194,7 @@ void goto_convertt::convert_CPROVER_throw(
194194
dest.add_instruction(ASSIGN);
195195

196196
t_set_exception->source_location=code.source_location();
197-
t_set_exception->code=code_assignt(exception_flag(), true_exprt());
197+
t_set_exception->code=code_assignt(exception_flag(mode), true_exprt());
198198
}
199199

200200
// do we catch locally?
@@ -244,7 +244,7 @@ void goto_convertt::convert_CPROVER_try_finally(
244244
convert(to_code(code.op1()), dest, mode);
245245
}
246246

247-
symbol_exprt goto_convertt::exception_flag()
247+
symbol_exprt goto_convertt::exception_flag(const irep_idt &mode)
248248
{
249249
irep_idt id="$exception_flag";
250250

@@ -260,6 +260,7 @@ symbol_exprt goto_convertt::exception_flag()
260260
new_symbol.is_thread_local=true;
261261
new_symbol.is_file_local=false;
262262
new_symbol.type=bool_typet();
263+
new_symbol.mode = mode;
263264
symbol_table.insert(std::move(new_symbol));
264265
}
265266

0 commit comments

Comments
 (0)