Commit 8c197eb
Gabor Horvath
[cxx-interop] Delay lowering unowned convention until ownership elimination
Unowned result conventions do not work well with OSSA. Retain the result
right after the call when we come out of OSSA so we can treat the
returned value as if it was owned when we do optimizations.
This fix a miscompilation due to the DestroyAddrHoisting pass hoisting
destroys above copies with unowned sources. When the destroyed object
was the last reference to the pointed memory the copy is happening too
late resulting in a use after free.
rdar://1604628541 parent bc88160 commit 8c197eb
File tree
5 files changed
+70
-5
lines changed- lib
- SILGen
- SILOptimizer/Mandatory
- SIL/IR
- test/Interop/Cxx/foreign-reference
- Inputs
5 files changed
+70
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
658 | 663 | | |
659 | 664 | | |
660 | 665 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6188 | 6188 | | |
6189 | 6189 | | |
6190 | 6190 | | |
6191 | | - | |
6192 | | - | |
6193 | | - | |
6194 | | - | |
6195 | 6191 | | |
6196 | 6192 | | |
6197 | 6193 | | |
| 6194 | + | |
| 6195 | + | |
| 6196 | + | |
6198 | 6197 | | |
6199 | 6198 | | |
6200 | 6199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
404 | 406 | | |
405 | 407 | | |
406 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
407 | 419 | | |
408 | 420 | | |
409 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | | - | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments