mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
EscapeUtils: consider that a pointer argument can escape a function call
Unlike addresses of indirect arguments, a pointer argument (e.g. `UnsafePointer`) can escape a function call. For example, it can be returned. Fixes a miscompile rdar://154124497
This commit is contained in:
@@ -640,7 +640,7 @@ fileprivate struct EscapeWalker<V: EscapeVisitor> : ValueDefUseWalker,
|
||||
}
|
||||
|
||||
// Indirect arguments cannot escape the function, but loaded values from such can.
|
||||
if !followLoads(at: path) {
|
||||
if argOp.value.type.isAddress && !followLoads(at: path) {
|
||||
if let beginApply = apply as? BeginApplyInst {
|
||||
// begin_apply can yield an address value.
|
||||
if !indirectResultEscapes(of: beginApply, path: path) {
|
||||
|
||||
Reference in New Issue
Block a user