File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -1156,24 +1156,30 @@ std::string expr2ct::convert_allocate(const exprt &src, unsigned &precedence)
1156
1156
if (src.operands ().size () != 2 )
1157
1157
return convert_norep (src, precedence);
1158
1158
1159
- unsigned p0;
1160
- std::string op0 = convert_with_precedence (to_binary_expr (src).op0 (), p0);
1159
+ const binary_exprt &binary_expr = to_binary_expr (src);
1161
1160
1162
1161
unsigned p1;
1163
- std::string op1 = convert_with_precedence (to_binary_expr (src) .op1 (), p1);
1162
+ std::string op1 = convert_with_precedence (binary_expr .op1 (), p1);
1164
1163
1165
- std::string dest = " ALLOCATE " ;
1164
+ std::string dest = CPROVER_PREFIX " allocate " ;
1166
1165
dest += ' (' ;
1167
1166
1167
+ const typet &type =
1168
+ static_cast <const typet &>(binary_expr.op0 ().find (ID_C_c_sizeof_type));
1168
1169
if (
1169
1170
src.type ().id () == ID_pointer &&
1170
- to_pointer_type (src.type ()).base_type (). id () != ID_empty )
1171
+ to_pointer_type (src.type ()).base_type () == type )
1171
1172
{
1172
- dest += convert (to_pointer_type (src.type ()).base_type ());
1173
+ dest += " sizeof( " + convert (to_pointer_type (src.type ()).base_type ()) + ' ) ' ;
1173
1174
dest+=" , " ;
1174
1175
}
1176
+ else
1177
+ {
1178
+ unsigned p0;
1179
+ dest += convert_with_precedence (binary_expr.op0 (), p0);
1180
+ }
1175
1181
1176
- dest += op0 + " , " + op1;
1182
+ dest += " , " + op1;
1177
1183
dest += ' )' ;
1178
1184
1179
1185
return dest;
You can’t perform that action at this time.
0 commit comments