[SR-282] Compiler crash unless whole mod opt. SIMD subscript
| Previous ID | SR-282 |
| Radar | rdar://23730732 |
| Original Reporter | @jepers |
| Type | Bug |
| Status | Closed |
| Resolution | Cannot Reproduce |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | @jepers |
| Priority | Medium |
md5: 5771011c4a0f170795994ff54092811e
is duplicated by:
- SR-301 Error when adding MutableCollectionType conformance to SIMD float4
Issue Description:
This program compiles and works as expected only when compiling with
-O -whole-module-optimization
otherwise it crashes the compiler.
It seems to have something to do with the set-part of the subscript.
$ cat > t.swift
import simd
protocol P {
typealias Element
var count: Int { get }
subscript(index: Int) -> Element { get set }
init()
}
extension float4 : P {
typealias Element = Float
var count: Int { return 4 }
}
func justToTestP<T: P where T.Element == Float>(_:T.Type) {
var a = T(); for i in 0 ..< a.count { a[i] = Float(i) }
print((0 ..< a.count).map { "\(a[$0])" }.joinWithSeparator(", "),
"(So it worked!)")
}
justToTestP(float4)
$ swiftc -O -whole-module-optimization t.swift && ./t
0.0, 1.0, 2.0, 3.0 (So it worked!)
$ swiftc -O t.swift && ./t
Undefined symbols for architecture x86_64:
"__TFV4simd6float4m9subscriptFSiSf", referenced from:
__TTWV4simd6float41t1PS1_FS2_m9subscriptFSiqq_S2_7Element in t-c529a6.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
(Same crash with anything other than -O -whole-module-optimization.)
@slavapestov, this looks like the same "retroactive conformance synthesizes accessors" problem, yes?
Hi Jens,
This does not reproduce with me with the Swift 2.2 / Xcode 7.3 release, so I think it got fixed at some point in the development cycle.
Can you give it a try to see if you can still reproduce it with the newer compiler?
Mark
I have verified that it is fixed in Xcode 7.3 / Swift 2.2.