swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.38k stars 10.34k forks source link

Runtime crash calling method on existential #76014

Open Jnosh opened 1 month ago

Jnosh commented 1 month ago

Description

The following snippet crashes at runtime when trying to invoke read. Perhaps a malformed witness table for the existential?

This started with the Xcode 16.0 beta 6 toolchain, it runs fine with the beta 5 toolchain.

I've only been able to reproduce this with the specific types involved so far, so the example is reduced but depends on an external library, GRDB.

Preconfigured Xcode project

Reproduction

import GRDB

let queue = try DatabaseQueue()
let writer = queue as any DatabaseWriter
// Thread 1: EXC_BAD_ACCESS (code=1, address=0x28)
try writer.read { db in }

Stack dump

-

Expected behavior

Should not crash.

Environment

Xcode 16 beta 6 15.0 Beta (24A5327a)

swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2) Target: arm64-apple-macosx15.0

GRDB v6.29.1

Additional information

No response

Jnosh commented 2 weeks ago

Related GRDB issues: 1596, 1619

Jnosh commented 1 week ago

Still present in the final Xcode 16 release and Xcode 16.1 Beta 2.

I have a suspicion that this might be fixed by https://github.com/swiftlang/swift/pull/76383 but unfortunately I can't verify that since the snapshot toolchains from swift.org are not currently functional.

Jnosh commented 3 days ago

Issue is still present in the just released Swift 6.0.1 toolchain.