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-12456] Swift 5.2 - Segmentation Fault of didSet override of a computed class property #54895

Closed
swift-ci opened this issue Mar 30, 2020 · 1 comment
Assignees
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

Previous ID SR-12456
Radar None
Original Reporter lennart.stolz@westwing.de (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

macOS 10.15.3 | Xcode 11.4 | Swift 5.2

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash, TypeChecker
Assignee @hamishknight
Priority Medium

md5: 2cfb06cf828fdae23571c9a9f46e4e65

Issue Description:

Hi,

Thanks for considering this bug.
Please let me know in case I can help you with further information. This is the minimal working example I came up with to run into the issue.

Minimal Working Example

The following piece of code is causing a segmentation fault (11) since Swift 5.2

class Foo {

    open class var instance: Foo {
        get {
            return Foo()
        }
        set {
            print("All fine ...")
        }
    }

}

class Narf: Foo {

    override class var instance: Foo {
        didSet {
            print("I cause the seg fault .. :-(")
        }
    }

}

Output

// Stack dump:Stack dump:0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret foo2.swift -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name foo21. Apple Swift version 5.2 (swiftlang-1103.0.32.1 clang-1103.0.32.29)2. While evaluating request TypeCheckSourceFileRequest(source_file "foo2.swift", 0)3. While evaluating request TypeCheckFunctionBodyUntilRequest(foo2.(file).Narf._@foo2.swift:16:24, )4. While type-checking getter for instance (at foo2.swift:16:24)5. While evaluating request ParseAbstractFunctionBodyRequest(foo2.(file).Narf._@foo2.swift:16:24)0  swift                    0x000000010aeb44ea PrintStackTraceSignalHandler(void*) + 421  swift                    0x000000010aeb3cc0 SignalHandler(int) + 3522  libsystem_platform.dylib 0x00007fff7303342d _sigtramp + 293  libsystem_platform.dylib 0x00007fb114861158 _sigtramp + 27097081044  swift                    0x00000001078bc2a6 synthesizeAccessorBody(swift::AbstractFunctionDecl*, void*) + 17025  swift                    0x0000000107aef4a8 swift::SimpleRequest<swift::ParseAbstractFunctionBodyRequest, swift::BraceStmt* (swift::AbstractFunctionDecl*), (swift::CacheKind)2>::evaluateRequest(swift::ParseAbstractFunctionBodyRequest const&, swift::Evaluator&) + 1686  swift                    0x0000000107c0713b swift::ParseAbstractFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::ParseAbstractFunctionBodyRequest>(swift::Evaluator&, swift::ParseAbstractFunctionBodyRequest, swift::ParseAbstractFunctionBodyRequest::OutputType) + 12117  swift                    0x00000001078a9ab4 swift::SimpleRequest<swift::TypeCheckFunctionBodyUntilRequest, bool (swift::AbstractFunctionDecl*, swift::SourceLoc), (swift::CacheKind)1>::evaluateRequest(swift::TypeCheckFunctionBodyUntilRequest const&, swift::Evaluator&) + 7568  swift                    0x00000001078b0b6e swift::TypeCheckFunctionBodyUntilRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyUntilRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyUntilRequest, swift::TypeCheckFunctionBodyUntilRequest::OutputType) + 7189  swift                    0x00000001078df6ce swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*, unsigned int) const + 627010 swift                    0x00000001078aeb47 swift::SimpleRequest<swift::TypeCheckSourceFileRequest, bool (swift::SourceFile*, unsigned int), (swift::CacheKind)2>::evaluateRequest(swift::TypeCheckSourceFileRequest const&, swift::Evaluator&) + 2311 swift                    0x00000001078dcfce swift::performTypeChecking(swift::SourceFile&, unsigned int) + 100612 swift                    0x0000000106f1105b swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 591513 swift                    0x0000000106bfd2c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 1028114 swift                    0x0000000106b7e4d3 main + 128315 libdyld.dylib            0x00007fff72e3a7fd start + 116 libdyld.dylib            0x000000000000000b start + 2367445007[1]    67342 segmentation fault  swift foo2.swift
@hamishknight
Copy link
Collaborator

Resolved by #30792 please verify using the next available development snapshot from https://swift.org/download/#snapshots.

@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

3 participants