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)
11561156 if (src.operands ().size () != 2 )
11571157 return convert_norep (src, precedence);
11581158
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);
11611160
11621161 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);
11641163
1165- std::string dest = " ALLOCATE " ;
1164+ std::string dest = CPROVER_PREFIX " allocate " ;
11661165 dest += ' (' ;
11671166
1167+ const typet &type =
1168+ static_cast <const typet &>(binary_expr.op0 ().find (ID_C_c_sizeof_type));
11681169 if (
11691170 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 )
11711172 {
1172- dest += convert (to_pointer_type (src.type ()).base_type ());
1173+ dest += " sizeof( " + convert (to_pointer_type (src.type ()).base_type ()) + ' ) ' ;
11731174 dest+=" , " ;
11741175 }
1176+ else
1177+ {
1178+ unsigned p0;
1179+ dest += convert_with_precedence (binary_expr.op0 (), p0);
1180+ }
11751181
1176- dest += op0 + " , " + op1;
1182+ dest += " , " + op1;
11771183 dest += ' )' ;
11781184
11791185 return dest;
You can’t perform that action at this time.
0 commit comments