Skip to content

Commit 46f2237

Browse files
committed
Fix edge case for STL bit string termination
Since the RLO is only modeled implicitly, changing a value that was pushed on the RLO previously modifies the RLO post hoc. This fix should allow for correct results when a value that contributes to the RLO is modified.
1 parent 6d745f8 commit 46f2237

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/statement-list/statement_list_typecheck.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,9 @@ void statement_list_typecheckt::typecheck_statement_list_assign(
10461046
tia_element.value.add_to_operands(assignment);
10471047
fc_bit = false;
10481048
or_bit = false;
1049+
// Set RLO to assigned operand in order to prevent false results if a symbol
1050+
// that's implicitly part of the RLO was changed by the assignment.
1051+
rlo_bit = lhs;
10491052
}
10501053

10511054
void statement_list_typecheckt::typecheck_statement_list_set_rlo(
@@ -1078,6 +1081,9 @@ void statement_list_typecheckt::typecheck_statement_list_set(
10781081
tia_element.value.add_to_operands(ifthen);
10791082
fc_bit = false;
10801083
or_bit = false;
1084+
// Set RLO to assigned operand in order to prevent false results if a symbol
1085+
// that's implicitly part of the RLO was changed by the assignment.
1086+
rlo_bit = lhs;
10811087
}
10821088

10831089
void statement_list_typecheckt::typecheck_statement_list_reset(
@@ -1092,6 +1098,9 @@ void statement_list_typecheckt::typecheck_statement_list_reset(
10921098
tia_element.value.add_to_operands(ifthen);
10931099
fc_bit = false;
10941100
or_bit = false;
1101+
// Set RLO to assigned operand in order to prevent false results if a symbol
1102+
// that's implicitly part of the RLO was changed by the assignment.
1103+
rlo_bit = lhs;
10951104
}
10961105

10971106
void statement_list_typecheckt::typecheck_statement_list_call(

0 commit comments

Comments
 (0)