@@ -43,6 +43,14 @@ static symbol_exprt find_base_symbol(const exprt &expr)
43
43
{
44
44
return find_base_symbol (to_dereference_expr (expr).pointer ());
45
45
}
46
+ else if (expr.id () == ID_typecast)
47
+ {
48
+ return find_base_symbol (to_typecast_expr (expr).op ());
49
+ }
50
+ else if (expr.id () == ID_address_of)
51
+ {
52
+ return find_base_symbol (to_address_of_expr (expr).op ());
53
+ }
46
54
else
47
55
{
48
56
throw " unsupported expression type for finding base symbol" ;
@@ -63,6 +71,10 @@ static exprt convert_statement_expression(
63
71
INVARIANT (
64
72
natural_loops.loop_map .size () == 0 , " quantifier must not contain loops" );
65
73
74
+ std::unordered_set<symbol_exprt, irep_hash> declared_symbols;
75
+ // All bound variables are local.
76
+ declared_symbols.insert (qex.variables ().begin (), qex.variables ().end ());
77
+
66
78
// `last` is the instruction corresponding to the last expression in the
67
79
// statement expression.
68
80
goto_programt::const_targett last = where.instructions .end ();
@@ -75,13 +87,24 @@ static exprt convert_statement_expression(
75
87
{
76
88
last = it;
77
89
}
90
+
91
+ if (it->is_decl ())
92
+ {
93
+ declared_symbols.insert (it->decl_symbol ());
94
+ }
78
95
}
79
96
80
97
DATA_INVARIANT (
81
98
last != where.instructions .end (),
82
99
" expression statements must contain a terminator expression" );
83
100
84
101
auto last_expr = to_code_expression (last->get_other ()).expression ();
102
+ if (
103
+ last_expr.id () == ID_typecast &&
104
+ to_typecast_expr (last_expr).type ().id () == ID_empty)
105
+ {
106
+ to_typecast_expr (last_expr).type () = bool_typet ();
107
+ }
85
108
86
109
struct pathst
87
110
{
@@ -139,10 +162,6 @@ static exprt convert_statement_expression(
139
162
{1 , where.instructions .begin ()},
140
163
{1 , std::make_pair (true_exprt (), replace_mapt ())});
141
164
142
- std::unordered_set<symbol_exprt, irep_hash> declared_symbols;
143
- // All bound variables are local.
144
- declared_symbols.insert(qex.variables().begin(), qex.variables().end());
145
-
146
165
exprt res = true_exprt();
147
166
148
167
// Visit the quantifier body along `paths`.
@@ -151,9 +170,12 @@ static exprt convert_statement_expression(
151
170
auto ¤t_it = paths.back_it ();
152
171
auto &path_condition = paths.back_path_condition ();
153
172
auto &value_map = paths.back_value_map ();
154
- INVARIANT (
155
- current_it != where.instructions .end (),
156
- " Quantifier body must have a unique end expression." );
173
+
174
+ if (current_it == where.instructions .end ())
175
+ {
176
+ paths.pop_back ();
177
+ continue ;
178
+ }
157
179
158
180
switch (current_it->type ())
159
181
{
0 commit comments