Skip to content

Commit 70b89c3

Browse files
Ensure that _Bool parameter has only 0 or 1 values
1 parent a174145 commit 70b89c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ansi-c/ansi_c_entry_point.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ exprt::operandst build_function_environment(
7474

7575
init_code.add(decl);
7676

77+
// nondet init for _Bool
78+
if(decl.symbol().type().id()==ID_c_bool)
79+
{
80+
code_assignt assign(
81+
decl.symbol(),
82+
typecast_exprt(
83+
side_effect_expr_nondett(bool_typet()),
84+
decl.symbol().type()));
85+
86+
init_code.move_to_operands(assign);
87+
}
88+
7789
codet input(ID_input);
7890
input.operands().resize(2);
7991

0 commit comments

Comments
 (0)