@@ -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,18 @@ 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 (
1466
+ {
1467
+ exprt val = bits2expr (
1470
1468
bits,
1471
1469
ns.follow_tag (to_c_enum_tag_type (type)),
1472
1470
little_endian);
1471
+ val.type () = type;
1472
+ return val;
1473
+ }
1473
1474
else if (type.id ()==ID_union)
1474
1475
{
1475
1476
// find a suitable member
@@ -1486,6 +1487,15 @@ exprt simplify_exprt::bits2expr(
1486
1487
return union_exprt (component.get_name (), val, type);
1487
1488
}
1488
1489
}
1490
+ else if (type.id ()==ID_union_tag)
1491
+ {
1492
+ exprt val = bits2expr (
1493
+ bits,
1494
+ ns.follow_tag (to_union_tag_type (type)),
1495
+ little_endian);
1496
+ val.type () = type;
1497
+ return val;
1498
+ }
1489
1499
else if (type.id ()==ID_struct)
1490
1500
{
1491
1501
const struct_typet &struct_type=to_struct_type (type);
@@ -1516,6 +1526,15 @@ exprt simplify_exprt::bits2expr(
1516
1526
1517
1527
return std::move (result);
1518
1528
}
1529
+ else if (type.id ()==ID_struct_tag)
1530
+ {
1531
+ exprt val = bits2expr (
1532
+ bits,
1533
+ ns.follow_tag (to_struct_tag_type (type)),
1534
+ little_endian);
1535
+ val.type () = type;
1536
+ return val;
1537
+ }
1519
1538
else if (type.id ()==ID_array)
1520
1539
{
1521
1540
const array_typet &array_type=to_array_type (type);
0 commit comments