@@ -973,26 +973,38 @@ void value_sett::get_value_set_rec(
973
973
(expr.type ().id () == ID_struct_tag || expr.type ().id () == ID_struct) &&
974
974
!suffix.empty ())
975
975
{
976
- irep_idt component_name = with_expr.where ().get (ID_component_name);
977
- if (suffix_starts_with_field (suffix, id2string (component_name)))
976
+ bool any_matching_suffix = false ;
977
+ bool all_matching_component_names = true ;
978
+ for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
978
979
{
979
- // Looking for the member overwritten by this WITH expression
980
- std::string remaining_suffix =
981
- strip_first_field_from_suffix (suffix, id2string (component_name));
982
- get_value_set_rec (
983
- with_expr.new_value (),
984
- dest,
985
- includes_nondet_pointer,
986
- remaining_suffix,
987
- original_type,
988
- ns);
980
+ irep_idt component_name =
981
+ with_expr.operands ()[i].get (ID_component_name);
982
+ if (suffix_starts_with_field (suffix, id2string (component_name)))
983
+ {
984
+ // Looking for the member overwritten by this WITH expression
985
+ any_matching_suffix = true ;
986
+ std::string remaining_suffix =
987
+ strip_first_field_from_suffix (suffix, id2string (component_name));
988
+ get_value_set_rec (
989
+ with_expr.operands ()[i + 1 ],
990
+ dest,
991
+ includes_nondet_pointer,
992
+ remaining_suffix,
993
+ original_type,
994
+ ns);
995
+ }
996
+ else if (
997
+ all_matching_component_names &&
998
+ (expr.type ().id () != ID_struct ||
999
+ !to_struct_type (expr.type ()).has_component (component_name)) &&
1000
+ (expr.type ().id () != ID_struct_tag ||
1001
+ !ns.follow_tag (to_struct_tag_type (expr.type ()))
1002
+ .has_component (component_name)))
1003
+ {
1004
+ all_matching_component_names = false ;
1005
+ }
989
1006
}
990
- else if (
991
- (expr.type ().id () == ID_struct &&
992
- to_struct_type (expr.type ()).has_component (component_name)) ||
993
- (expr.type ().id () == ID_struct_tag &&
994
- ns.follow_tag (to_struct_tag_type (expr.type ()))
995
- .has_component (component_name)))
1007
+ if (!any_matching_suffix && all_matching_component_names)
996
1008
{
997
1009
// Looking for a non-overwritten member, look through this expression
998
1010
get_value_set_rec (
@@ -1003,7 +1015,7 @@ void value_sett::get_value_set_rec(
1003
1015
original_type,
1004
1016
ns);
1005
1017
}
1006
- else
1018
+ else if (!any_matching_suffix)
1007
1019
{
1008
1020
// Member we're looking for is not defined in this struct -- this
1009
1021
// must be a reinterpret cast of some sort. Default to conservatively
@@ -1015,13 +1027,16 @@ void value_sett::get_value_set_rec(
1015
1027
suffix,
1016
1028
original_type,
1017
1029
ns);
1018
- get_value_set_rec (
1019
- with_expr.new_value (),
1020
- dest,
1021
- includes_nondet_pointer,
1022
- " " ,
1023
- original_type,
1024
- ns);
1030
+ for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
1031
+ {
1032
+ get_value_set_rec (
1033
+ with_expr.operands ()[i + 1 ],
1034
+ dest,
1035
+ includes_nondet_pointer,
1036
+ " " ,
1037
+ original_type,
1038
+ ns);
1039
+ }
1025
1040
}
1026
1041
}
1027
1042
else if (expr.type ().id () == ID_array && !suffix.empty ())
@@ -1040,13 +1055,16 @@ void value_sett::get_value_set_rec(
1040
1055
suffix,
1041
1056
original_type,
1042
1057
ns);
1043
- get_value_set_rec (
1044
- with_expr.new_value (),
1045
- dest,
1046
- includes_nondet_pointer,
1047
- new_value_suffix,
1048
- original_type,
1049
- ns);
1058
+ for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
1059
+ {
1060
+ get_value_set_rec (
1061
+ with_expr.operands ()[i + 1 ],
1062
+ dest,
1063
+ includes_nondet_pointer,
1064
+ new_value_suffix,
1065
+ original_type,
1066
+ ns);
1067
+ }
1050
1068
}
1051
1069
else
1052
1070
{
@@ -1059,13 +1077,16 @@ void value_sett::get_value_set_rec(
1059
1077
suffix,
1060
1078
original_type,
1061
1079
ns);
1062
- get_value_set_rec (
1063
- with_expr.new_value (),
1064
- dest,
1065
- includes_nondet_pointer,
1066
- " " ,
1067
- original_type,
1068
- ns);
1080
+ for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
1081
+ {
1082
+ get_value_set_rec (
1083
+ with_expr.operands ()[i + 1 ],
1084
+ dest,
1085
+ includes_nondet_pointer,
1086
+ " " ,
1087
+ original_type,
1088
+ ns);
1089
+ }
1069
1090
}
1070
1091
}
1071
1092
else if (expr.id ()==ID_array)
@@ -1624,14 +1645,18 @@ void value_sett::assign(
1624
1645
}
1625
1646
else if (rhs.id ()==ID_with)
1626
1647
{
1648
+ const with_exprt &with_expr = to_with_expr (rhs);
1627
1649
const index_exprt op0_index (
1628
- to_with_expr (rhs) .old (),
1650
+ with_expr .old (),
1629
1651
exprt (ID_unknown, c_index_type ()),
1630
1652
to_array_type (lhs.type ()).element_type ());
1631
1653
1632
1654
assign (lhs_index, op0_index, ns, is_simplified, add_to_sets);
1633
- assign (
1634
- lhs_index, to_with_expr (rhs).new_value (), ns, is_simplified, true );
1655
+ for (std::size_t i = 1 ; i < with_expr.operands ().size (); i += 2 )
1656
+ {
1657
+ assign (
1658
+ lhs_index, with_expr.operands ()[i + 1 ], ns, is_simplified, true );
1659
+ }
1635
1660
}
1636
1661
else
1637
1662
{
0 commit comments