Files
swift-mirror/test/SILOptimizer/simplify_cfg_crash.swift
Erik Eckstein 653b6ecc33 fix a crash/hang in SimplifyCFG.
Jump threading in an unreachable CFG region can lead to a crash (in an assert compiler) or hang (in an no-assert compiler) in `ValueBase::replaceAllUsesWith`.

Unfortunately I couldn't come up with an isolated SIL test case.

rdar://92267349
2022-04-25 16:48:59 +02:00

17 lines
239 B
Swift

// RUN: %target-swift-frontend -O %s -emit-sil -o /dev/null
public class X {}
public func testit(_ s: [X]) -> X? {
var r: X?
for e in s {
if r == nil {
r = e
} else if e !== r {
return nil
}
}
return r
}