Skip to content

Commit af1ae08

Browse files
simonvandelMark-Simulacrum
authored andcommitted
Fix miscompile in SimplifyBranchSame
1 parent 3a68d86 commit af1ae08

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/rustc_mir/src/transform/simplify_try.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ impl<'a, 'tcx> SimplifyBranchSameOptimizationFinder<'a, 'tcx> {
628628
// All successor basic blocks must be equal or contain statements that are pairwise considered equal.
629629
for ((target_and_value_l,bb_l), (target_and_value_r,bb_r)) in iter_bbs_reachable.tuple_windows() {
630630
let trivial_checks = bb_l.is_cleanup == bb_r.is_cleanup
631-
&& bb_l.terminator().kind == bb_r.terminator().kind;
631+
&& bb_l.terminator().kind == bb_r.terminator().kind
632+
&& bb_l.statements.len() == bb_r.statements.len();
632633
let statement_check = || {
633634
bb_l.statements.iter().zip(&bb_r.statements).try_fold(StatementEquality::TrivialEqual, |acc,(l,r)| {
634635
let stmt_equality = self.statement_equality(*adt_matched_on, &l, target_and_value_l, &r, target_and_value_r);

0 commit comments

Comments
 (0)