@@ -1431,12 +1431,10 @@ bool simplify_exprt::simplify_object(exprt &expr)
1431
1431
1432
1432
exprt simplify_exprt::bits2expr (
1433
1433
const std::string &bits,
1434
- const typet &_type ,
1434
+ const typet &type ,
1435
1435
bool little_endian)
1436
1436
{
1437
1437
// bits start at lowest memory address
1438
- const typet &type=ns.follow (_type);
1439
-
1440
1438
auto type_bits = pointer_offset_bits (type, ns);
1441
1439
1442
1440
if (!type_bits.has_value () || *type_bits != bits.size ())
@@ -1461,15 +1459,16 @@ exprt simplify_exprt::bits2expr(
1461
1459
else if (type.id ()==ID_c_enum)
1462
1460
{
1463
1461
exprt val = bits2expr (bits, to_c_enum_type (type).subtype (), little_endian);
1464
- val.type ()= type;
1462
+ val.type () = type;
1465
1463
return val;
1466
1464
}
1467
1465
else if (type.id ()==ID_c_enum_tag)
1468
- return
1469
- bits2expr (
1470
- bits,
1471
- ns.follow_tag (to_c_enum_tag_type (type)),
1472
- little_endian);
1466
+ {
1467
+ exprt val =
1468
+ bits2expr (bits, ns.follow_tag (to_c_enum_tag_type (type)), little_endian);
1469
+ val.type () = type;
1470
+ return val;
1471
+ }
1473
1472
else if (type.id ()==ID_union)
1474
1473
{
1475
1474
// find a suitable member
@@ -1486,6 +1485,13 @@ exprt simplify_exprt::bits2expr(
1486
1485
return union_exprt (component.get_name (), val, type);
1487
1486
}
1488
1487
}
1488
+ else if (type.id () == ID_union_tag)
1489
+ {
1490
+ exprt val =
1491
+ bits2expr (bits, ns.follow_tag (to_union_tag_type (type)), little_endian);
1492
+ val.type () = type;
1493
+ return val;
1494
+ }
1489
1495
else if (type.id ()==ID_struct)
1490
1496
{
1491
1497
const struct_typet &struct_type=to_struct_type (type);
@@ -1516,6 +1522,13 @@ exprt simplify_exprt::bits2expr(
1516
1522
1517
1523
return std::move (result);
1518
1524
}
1525
+ else if (type.id () == ID_struct_tag)
1526
+ {
1527
+ exprt val =
1528
+ bits2expr (bits, ns.follow_tag (to_struct_tag_type (type)), little_endian);
1529
+ val.type () = type;
1530
+ return val;
1531
+ }
1519
1532
else if (type.id ()==ID_array)
1520
1533
{
1521
1534
const array_typet &array_type=to_array_type (type);
0 commit comments