Skip to content

Commit dc86186

Browse files
Dave AbrahamsDave Abrahams
authored andcommitted
[stdlib] Speculative workaround for ASAN failure
I suspect the fancy _unsafeUpcast implementation, that was supposed to be more optimizable, was confusing the optimizer, and that is the cause of ASAN failures we're seeing. Let's see if this makes ASAN happy again.
1 parent 219daed commit dc86186

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/public/core/HashedCollections.swift.gyb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,8 +1265,14 @@ func _impossible<T>(_:T.Type) -> T {
12651265
}
12661266

12671267
func _unsafeUpcast<T, U>(_ x: T, to: U.Type) -> U {
1268+
#if False
1269+
// disabled temporarily to speculatively work around a supposed optimizer bug
1270+
// that is triggering ASAN failures.
12681271
_sanityCheck(x is U)
12691272
return x as? U ?? _impossible(U.self)
1273+
#else
1274+
return x as! U
1275+
#endif
12701276
}
12711277

12721278
/// Perform a non-bridged upcast that always succeeds.

0 commit comments

Comments
 (0)