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-12501] Override a property wrapper variable to add didSet crashes #54943

Closed
swift-ci opened this issue Apr 4, 2020 · 6 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 4, 2020

Previous ID SR-12501
Radar None
Original Reporter dlemex (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 10.4, Swift 5.2

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

md5: 3e2227a51754302ab911ba5dda6de271

duplicates:

  • SR-12443 Xcode 11.4 regression: Segfault when overriding property with property wrapper

Issue Description:

I have a simple property wrapper that implements thread safety using GCD. In order to add didSet to the property wrapped variables, I subclassed the object, then defines overrides of the wrapped variable and adds a didSet. When swift attempts to compile the module it traps with an illegal instruction 4.

Removing the override and the code complies just fine. This was working correctly in swift 5.1.3.

Reported to Apple: FB7615016

@LucianoPAlmeida
Copy link
Collaborator

This seems similar to recently fixed SR-12443, just tested seems fixed on master
cc @hamishknight

@hamishknight
Copy link
Collaborator

Yup, this has been fixed on master, please verify using the next available development snapshot from https://swift.org/download/#snapshots.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 8, 2020

Comment by David L. Edwards (JIRA)

I tested my test case project against the Swift 5.2 Snapshot 2020-04-07 (Swift a543bfb). The crash remains.

overridebug.zip

1. Apple Swift version 5.2.2-dev (Swift a543bfb)

2. While evaluating request TypeCheckSourceFileRequest(source_file "/Users/dlemex/Downloads/project/ThreadSafeTest/StatusSingleton.swift", 0)

3. While evaluating request TypeCheckFunctionBodyUntilRequest(ThreadSafeTest.(file).StatusSingleton._@/Users/dlemex/Downloads/project/ThreadSafeTest/StatusSingleton.swift:24:25, )

4. While type-checking setter for isStatusEnabled (at /Users/dlemex/Downloads/project/ThreadSafeTest/StatusSingleton.swift:24:25)

5. While evaluating request ParseAbstractFunctionBodyRequest(ThreadSafeTest.(file).StatusSingleton._@/Users/dlemex/Downloads/project/ThreadSafeTest/StatusSingleton.swift:24:25)

0 swift 0x0000000104569138 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40

1 swift 0x0000000104568355 llvm::sys::RunSignalHandlers() + 85

2 swift 0x0000000104569710 SignalHandler(int) + 272

3 libsystem_platform.dylib 0x00007fff712115fd _sigtramp + 29

4 libsystem_platform.dylib 0x0000000000004e68 _sigtramp + 2396993672

5 libsystem_c.dylib 0x00007fff710e7808 abort + 120

6 libsystem_c.dylib 0x00007fff710e6ac6 err + 0

7 swift 0x000000010481ba01 swift::buildSelfReference(swift::VarDecl*, swift::SelfAccessorKind, bool, swift::ASTContext&) (.cold.1) + 33

8 swift 0x000000010128c560 swift::buildArgumentForwardingExpr(llvm::ArrayRef<swift::ParamDecl*>, swift::ASTContext&) + 0

9 swift 0x00000001013d06a7 buildStorageReference(swift::AccessorDecl*, swift::AbstractStorageDecl*, (anonymous namespace)::TargetImpl, bool, swift::ASTContext&) + 951

10 swift 0x00000001013d1b33 synthesizeObservedSetterBody(swift::AccessorDecl*, (anonymous namespace)::TargetImpl, swift::ASTContext&) + 291

11 swift 0x00000001013cf71e synthesizeAccessorBody(swift::AbstractFunctionDecl*, void*) + 3118

12 swift 0x000000010158ba66 swift::ParseAbstractFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 294

13 swift 0x000000010158bb31 swift::SimpleRequest<swift::ParseAbstractFunctionBodyRequest, swift::BraceStmt* (swift::AbstractFunctionDecl*), (swift::CacheKind)2>::evaluateRequest(swift::ParseAbstractFunctionBodyRequest const&, swift::Evaluator&) + 17

14 swift 0x000000010172b591 llvm::Expected<swift::ParseAbstractFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::ParseAbstractFunctionBodyRequest>(swift::ParseAbstractFunctionBodyRequest const&) + 465

15 swift 0x000000010172b2c8 llvm::Expected<swift::ParseAbstractFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::ParseAbstractFunctionBodyRequest, (void*)0>(swift::ParseAbstractFunctionBodyRequest const&) + 72

16 swift 0x00000001016d7353 swift::ParseAbstractFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::ParseAbstractFunctionBodyRequest>(swift::Evaluator&, swift::ParseAbstractFunctionBodyRequest, swift::ParseAbstractFunctionBodyRequest::OutputType) + 35

@theblixguy
Copy link
Collaborator

dlemex (JIRA User) You need to download the master (trunk) snapshot, not the Swift 5.2 snapshot (as the fix wasn't merged into the 5.2 branch).

@beccadax
Copy link
Contributor

@swift-ci create

@hamishknight
Copy link
Collaborator

dlemex (JIRA User) As Suyash says, you need to test against a master development snapshot. I'm going to mark the issue as resolved again, but please do feel free to re-open if it's still reproducible on a master snapshot.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

6 participants