Swift compiler crash

Originator:abarnert
Number:rdar://17321142 Date Originated:2014-06-16
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.0 beta (6A215I)
Classification:Crash Reproducible:Always
 
While trying to create generic functions for transforming Sequences or Generators in various ways [initially, attempting to port Python's itertools to swift]. I keep running into crashes, where the compiler segfaults, apparently while trying to infer or check types somewhere.

See https://github.com/abarnert/swift-itertools/blob/d2de3034ee268cbdba3b36215d0915b5c4e17724/teetest.swift for an example that reliably crashes the compiler. Commenting out the code inside Tee.next (return nil), inside tee (return []), and at the top level has no effect. Changing either or both structs to classes replaces the segfault with a compiler fatal error ("LLVM ERROR: unimplemented IRGen feature! non-fixed class layout"), but that doesn't help much, and I don't think either one should be a class anyway (although I could easily be wrong).

Earlier attempts at many of the functions in https://github.com/abarnert/swift-itertools produced identical crashes. In some cases there was clearly a type error in my code (e.g., declaring a parameter or member as a Sequence instead of an S) that I was able to find and fix; in others, I just kept rewriting things until it worked, or figured out why it was impossible…

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!