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-11484] Segfault when using View as a generic on an ObservedObject #53884

Open
swift-ci opened this issue Sep 17, 2019 · 1 comment
Open
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 optimized only Flag: An issue whose reproduction requires optimized compilation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11484
Radar rdar://problem/55442328
Original Reporter plivesey (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode: Version 11.0 (11A419c)

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

md5: 111b5f424d6d6c64a3cad5efaeb27f70

Issue Description:

I've also attached a project which reproduces the issue

Reproduce:

Add this code:

// ModalManager.swift

class MiniModalManager: ObservableObject {
    @Published var modal: AnyView = AnyView(EmptyView())


    func show<V: View>(title: String, view: V) {
        modal = AnyView(view)
    }
}

// In another file, ContentView.swift

struct ContentView: View {
    @ObservedObject var manager = MiniModalManager()


    var body: some View {
        Text("Hello World")
            .onAppear {
                let view = Text("Hello world")
                self.manager.show(title: "title", view: view)
        }
    }
}

Expected: this code should compile

Actual:

Compile in DEBUG: successful

Compile in RELEASE for device: segfault

1. While running pass #&#8203;3511 SILFunctionTransform "GenericSpecializer" on SILFunction "@$s19ViewGenericSegFault16MiniModalManagerC4show5title4viewySS_xt7SwiftUI0A0RzlFAG4TextV_Tg5". for 'show(title:view:)' (at /Users/peterlivesey/Repo/ViewGenericSegFault/ViewGenericSegFault/ModalManager.swift:15:5) 0  swift                    0x00000001056feeb3 PrintStackTraceSignalHandler(void*) + 51 1  swift                    0x00000001056fe686 SignalHandler(int) + 358 2  libsystem_platform.dylib 0x00007fff6b690b1d _sigtramp + 29 3  libsystem_platform.dylib 0x00007fa706c80e40 _sigtramp + 2606695232 4  swift                    0x0000000101b4decc swift::ReabstractionInfo::prepareAndCheck(swift::ApplySite, swift::SILFunction*, swift::SubstitutionMap, swift::OptRemark::Emitter*) + 572 5  swift                    0x0000000101ba0aaa swift::ReabstractionInfo::ReabstractionInfo(swift::ApplySite, swift::SILFunction*, swift::SubstitutionMap, swift::IsSerialized_t, bool, swift::OptRemark::Emitter*) + 122 6  swift                    0x0000000101baab30 swift::trySpecializeApplyOfGeneric(swift::SILOptFunctionBuilder&, swift::ApplySite, llvm::SmallSetVector<swift::SILInstruction*, 8u>&, llvm::SmallVectorImpl<swift::SILFunction*>&, swift::OptRemark::Emitter&) + 1696 7  swift                    0x0000000101a8382e (anonymous namespace)::GenericSpecializer::run() + 2686 8  swift                    0x00000001019fcf97 swift::SILPassManager::execute() + 4599 9  swift                    0x000000010165b88b swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) + 6379 10 swift                    0x0000000101355cc5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 33925 11 swift                    0x000000010134a034 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820 12 swift                    0x00000001012d75a3 main + 1219 13 libdyld.dylib            0x00007fff6b48f2a5 start + 1 14 libdyld.dylib            0x000000000000004b start + 2495024551
@belkadan
Copy link
Contributor

@swift-ci create

@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
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 optimized only Flag: An issue whose reproduction requires optimized compilation
Projects
None yet
Development

No branches or pull requests

3 participants