Commit 1750f25
committed
Fix Bug 14: break and continue release the iteration's references
Both statements jumped past the loop body's scope-end drops, leaking every
reference created earlier in the iteration on the jump path (a finalizer-bearing
resource never finalized on a continued or broken iteration). Track the innermost
loop's body scope alongside the loop labels, and have break and continue walk the
scope chain up to and including it, releasing reference-typed variables declared
before the statement, then jump. This mirrors the early-return drop machinery and
is disjoint from the fall-through path, so nothing releases twice.
The added jump-path drop also gives affected variables a second drop, which the
move-elision single-drop guard already treats as not provably movable, so the fix
and the elision compose conservatively. Pinned with finalizer-oracle tests for
both statements. Found pre-existing by the elision adversarial review.1 parent 1560ff2 commit 1750f25
3 files changed
Lines changed: 97 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2066 | 2066 | | |
2067 | 2067 | | |
2068 | 2068 | | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
2069 | 2088 | | |
2070 | 2089 | | |
2071 | 2090 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1457 | 1457 | | |
1458 | 1458 | | |
1459 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1460 | 1464 | | |
1461 | 1465 | | |
1462 | 1466 | | |
| |||
1587 | 1591 | | |
1588 | 1592 | | |
1589 | 1593 | | |
| 1594 | + | |
1590 | 1595 | | |
1591 | 1596 | | |
1592 | 1597 | | |
| |||
5725 | 5730 | | |
5726 | 5731 | | |
5727 | 5732 | | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
| 5776 | + | |
5728 | 5777 | | |
5729 | 5778 | | |
5730 | 5779 | | |
| |||
6681 | 6730 | | |
6682 | 6731 | | |
6683 | 6732 | | |
| 6733 | + | |
6684 | 6734 | | |
6685 | 6735 | | |
6686 | 6736 | | |
6687 | 6737 | | |
6688 | 6738 | | |
6689 | 6739 | | |
6690 | 6740 | | |
| 6741 | + | |
6691 | 6742 | | |
6692 | 6743 | | |
6693 | 6744 | | |
| |||
6708 | 6759 | | |
6709 | 6760 | | |
6710 | 6761 | | |
6711 | | - | |
| 6762 | + | |
| 6763 | + | |
| 6764 | + | |
| 6765 | + | |
| 6766 | + | |
6712 | 6767 | | |
6713 | | - | |
| 6768 | + | |
6714 | 6769 | | |
6715 | 6770 | | |
6716 | 6771 | | |
| |||
6722 | 6777 | | |
6723 | 6778 | | |
6724 | 6779 | | |
6725 | | - | |
| 6780 | + | |
| 6781 | + | |
| 6782 | + | |
| 6783 | + | |
| 6784 | + | |
6726 | 6785 | | |
6727 | | - | |
| 6786 | + | |
6728 | 6787 | | |
6729 | 6788 | | |
6730 | 6789 | | |
| |||
0 commit comments