Files
swift-mirror/test/SILOptimizer/array_element_propagation_crash.swift
2020-08-07 00:26:07 -07:00

22 lines
463 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -O %s -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test
// Check that ArrayElementPropagation does not crash when compiling this function.
@inline(never)
func testit(_ arr: inout [Int]) {
let a = [28]
arr += [a[0]]
}
var a = [27]
testit(&a)
// As a bonus, also check if the code works as expected.
// CHECK: [27, 28]
print(a)