Commit c021e9b
committed
[addr-move-function] Fix memory safety issue found by ASAN.
The specific issue was I needed to add an '&' here:
```
- for (auto closureUse : useState.closureUses) {
+ for (auto &closureUse : useState.closureUses) {
```
without this, we eventually grab a pointer into the temporary closureUse instead
of the reference to the actual value in the data structure which we are trying
to actually pass a pointer off to.
I also added some small improvements to the debug printing in the pass that I
think helps understand how the code works here.
rdar://876185171 parent 840316a commit c021e9b
File tree
3 files changed
+9
-12
lines changed- lib/SILOptimizer/Mandatory
- test/SILOptimizer
3 files changed
+9
-12
lines changedLines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
825 | | - | |
| 825 | + | |
| 826 | + | |
826 | 827 | | |
827 | 828 | | |
828 | 829 | | |
| |||
1350 | 1351 | | |
1351 | 1352 | | |
1352 | 1353 | | |
| 1354 | + | |
1353 | 1355 | | |
1354 | 1356 | | |
1355 | 1357 | | |
| |||
1595 | 1597 | | |
1596 | 1598 | | |
1597 | 1599 | | |
| 1600 | + | |
| 1601 | + | |
1598 | 1602 | | |
1599 | 1603 | | |
1600 | 1604 | | |
1601 | 1605 | | |
1602 | 1606 | | |
1603 | | - | |
| 1607 | + | |
1604 | 1608 | | |
1605 | 1609 | | |
1606 | 1610 | | |
| |||
1644 | 1648 | | |
1645 | 1649 | | |
1646 | 1650 | | |
1647 | | - | |
| 1651 | + | |
| 1652 | + | |
1648 | 1653 | | |
1649 | 1654 | | |
1650 | 1655 | | |
| |||
1825 | 1830 | | |
1826 | 1831 | | |
1827 | 1832 | | |
1828 | | - | |
| 1833 | + | |
1829 | 1834 | | |
1830 | 1835 | | |
1831 | 1836 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
| |||
0 commit comments