swift compiler segfault

Originator:eden
Number:rdar://35128063 Date Originated:10/23/2017
Status:Open Resolved:
Product:Xcode Product Version:9.1 beta 2
Classification: Reproducible:Always
 
Summary:

Swift compiler crashes when compiling 

Steps to Reproduce:

Try to compile the following code:

class C {
    var strings: [String]? = nil
    func f(start: Int? = nil) {
        let start = start ?? 0
        guard start < strings?.count ?? 0, let strings = strings?[start...] else {
            return
        }
        // do something with strings
    }
}

Expected Results:

The code compiles.

Actual Results:

The swift compiler segfaults with the following error:

0.	While emitting SIL for 'f(start:)' at /path/to/temp/file:3:5

Version/Build:

Apple Swift version 4.0.1 (swiftlang-900.0.68 clang-900.0.38)
Target: x86_64-apple-macosx10.9

Configuration:

Xcode 9.1 beta 2

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!