Files
swift-mirror/test/SILOptimizer/stack_promotion_crash.swift
Erik Eckstein e6285b277a SILOptimizer: handle begin_apply in escape analysis
Just treat begin_apply conservatively.
It's probably not worth adding much complexity for begin_apply to the analysis as co-routines are often inlined anyway.

Fixes a miscompile.

https://bugs.swift.org/browse/SR-10444
rdar://problem/49755264
2019-04-11 12:52:22 -07:00

38 lines
590 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -O %s -o %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test
// Check that the compiled code does not crash because of a wrong
// stack-promoted array.
// End-to-end test for https://bugs.swift.org/browse/SR-10444
public struct Beta {
var gamma: [Int]
}
class Delta {
var epislon: Beta? = Beta(gamma: [])
func main() {
for _ in 1...100 {
crash()
}
}
func crash() {
epislon?.gamma = [0]
}
}
func testit() {
Delta().main()
}
testit()
// CHECK: ok
print("ok")