File tree 5 files changed +53
-2
lines changed
5 files changed +53
-2
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ void foo (_Bool y )
4
+ {
5
+ int x ;
6
+ if (y )
7
+ {
8
+ x = (int )y ;
9
+ assert (x == 1 );
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --function foo
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -73,6 +73,18 @@ exprt::operandst build_function_environment(
73
73
74
74
init_code.add (decl);
75
75
76
+ // nondet init for _Bool
77
+ if (decl.symbol ().type ().id ()==ID_c_bool)
78
+ {
79
+ code_assignt assign (
80
+ decl.symbol (),
81
+ typecast_exprt (
82
+ side_effect_expr_nondett (bool_typet ()),
83
+ decl.symbol ().type ()));
84
+
85
+ init_code.move_to_operands (assign);
86
+ }
87
+
76
88
codet input (ID_input);
77
89
input.operands ().resize (2 );
78
90
Original file line number Diff line number Diff line change @@ -265,6 +265,15 @@ json_objectt json(
265
265
result[" binary" ]=json_stringt (expr.is_true ()?" 1" :" 0" );
266
266
result[" data" ]=jsont::json_boolean (expr.is_true ());
267
267
}
268
+ else if (type.id ()==ID_c_bool)
269
+ {
270
+ result[" name" ]=json_stringt (" integer" );
271
+ result[" c_type" ]=json_stringt (" _Bool" );
272
+ result[" binary" ]=json_stringt (expr.get_string (ID_value));
273
+ mp_integer b;
274
+ to_integer (to_constant_expr (expr), b);
275
+ result[" data" ]=json_stringt (integer2string (b));
276
+ }
268
277
else
269
278
{
270
279
result[" name" ]=json_stringt (" unknown" );
Original file line number Diff line number Diff line change @@ -126,7 +126,8 @@ xmlt xml(
126
126
{
127
127
result.name =" vector" ;
128
128
result.new_element (" subtype" ).new_element ()=xml (type.subtype (), ns);
129
- result.new_element (" size" ).new_element ()=xml (to_vector_type (type).size (), ns);
129
+ result.new_element (" size" ).new_element ()=
130
+ xml (to_vector_type (type).size (), ns);
130
131
}
131
132
else if (type.id ()==ID_struct)
132
133
{
@@ -263,6 +264,15 @@ xmlt xml(
263
264
result.set_attribute (" binary" , expr.is_true ()?" 1" :" 0" );
264
265
result.data =expr.is_true ()?" TRUE" :" FALSE" ;
265
266
}
267
+ else if (type.id ()==ID_c_bool)
268
+ {
269
+ result.name =" integer" ;
270
+ result.set_attribute (" c_type" , " _Bool" );
271
+ result.set_attribute (" binary" , expr.get_string (ID_value));
272
+ mp_integer b;
273
+ to_integer (to_constant_expr (expr), b);
274
+ result.data =integer2string (b);
275
+ }
266
276
else
267
277
{
268
278
result.name =" unknown" ;
@@ -309,7 +319,8 @@ xmlt xml(
309
319
310
320
xmlt &e=result.new_element (" member" );
311
321
e.new_element (xml (expr.op0 (), ns));
312
- e.set_attribute (" member_name" ,
322
+ e.set_attribute (
323
+ " member_name" ,
313
324
id2string (to_union_expr (expr).get_component_name ()));
314
325
}
315
326
else
You can’t perform that action at this time.
0 commit comments