Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-15766] EXC_BAD_ACCESS overriding async throws function #58043

Closed
NachoSoto opened this issue Jan 23, 2022 · 4 comments
Closed

[SR-15766] EXC_BAD_ACCESS overriding async throws function #58043

NachoSoto opened this issue Jan 23, 2022 · 4 comments

Comments

@NachoSoto
Copy link
Contributor

@NachoSoto NachoSoto commented Jan 23, 2022

Previous ID SR-15766
Radar rdar://problem/88035174
Original Reporter @NachoSoto
Type Bug
Status Resolved
Resolution Done
Environment

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: arm64-apple-macosx12.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: ec2063df447055775a1cc30dede3ee9c

Issue Description:

class A {
    func f() async throws { }
}

class B: A {
    override func f() async { }
}

let b: A = B() // Note: let b = B() does compile correctly
print(try await b.f())

Expected result:

Code compiles

Actual result:

thread #​1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc7d9c5464100)
frame #​0: 0x0000000103c873e0 libobjc.A.dylib`objc_release + 16
frame #​1: 0x000000011c731878 libswift_Concurrency.dylib`swift::AsyncTask::~AsyncTask() + 116
frame #​2: 0x000000011c7318d0 libswift_Concurrency.dylib`destroyTask(swift::HeapObject*) + 16
frame #​3: 0x00000001037a3230 libswiftCore.dylib`_swift_release_dealloc + 28
frame #&#8203;4: 0x00000001063e0204 $__lldb_expr32`main at <compiler-generated>:0
frame #&#8203;5: 0x00000001023c34f0 Test`linkResources + 264
frame #&#8203;6: 0x0000000104df1030 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
frame #&#8203;7: 0x0000000104df02f4 CoreFoundation`__CFRunLoopDoBlocks + 408
frame #&#8203;8: 0x0000000104deabb0 CoreFoundation`__CFRunLoopRun + 764
frame #&#8203;9: 0x0000000104dea3a8 CoreFoundation`CFRunLoopRunSpecific + 572
frame #&#8203;10: 0x000000010ac135ec GraphicsServices`GSEventRunModal + 160
frame #&#8203;11: 0x000000010fee67ac UIKitCore`-[UIApplication _run] + 992
frame #&#8203;12: 0x000000010feeb2e8 UIKitCore`UIApplicationMain + 112
frame #&#8203;13: 0x00000001023c35b0 Test`main + 192
frame #&#8203;14: 0x00000001026d1ca0 dyld_sim`start_sim + 20
frame #&#8203;15: 0x00000001025190f4 dyld`start + 520

Notes:

  • Adding `throws` to the override fixes the issue

  • This works without `async`

  • I tested this on playgrounds. Obviously top level code can't be `async` like this, but the issue is reproducible from any function.

@DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 25, 2022

~sync create

@DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 25, 2022

@swift-ci create

@DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 25, 2022

Fix is coming... #41003

@DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 28, 2022

Fix is merged and cherry-picked to the 5.6 branch. Thanks!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants