Skip to content

[SR-12891] Compiles with debug and -O, but crashes with whole module optimizations #55337

Closed
@jepers

Description

@jepers
Previous ID SR-12891
Radar rdar://problem/63819461
Original Reporter @jepers
Type Bug
Status Resolved
Resolution Done
Environment

Swift 5.2, macOS 10.15.4

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee @aschwaighofer
Priority Medium

md5: 431344b288aa785896f8b112bc445565

Issue Description:

This program:

enum E {}
protocol P { associatedtype AT }
struct S<A, B> {}
extension S: P where A == E { typealias AT = B }
print(S<E, Bool>.AT.self)

Compiles and runs as expected unless it's compiled with whole module optimizations:

{code: swift}
$ swiftc --version
Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
Target: x86_64-apple-darwin19.4.0

$ swiftc test.swift && ./test
Bool
$ swiftc -O test.swift && ./test
Bool
$ swiftc -O -wmo test.swift && ./test
Undefined symbols for architecture x86_64:
"_$s4test1EOMn", referenced from:
symbolic ____ 4test1EO in test-0010e5.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)

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions