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-11052] typealias of associated type of associated type yields seg11/not found #53441

Closed
tcldr opened this issue Jun 30, 2019 · 3 comments
Closed
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

Comments

@tcldr
Copy link

tcldr commented Jun 30, 2019

Previous ID SR-11052
Radar rdar://problem/52463696
Original Reporter @tcldr
Type Bug
Status Resolved
Resolution Done
Environment

Seems to manifest on both 5.0.1 and 5.1.

On 5.0.1:

Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.6.0
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file Alias.swift -target x86_64-apple-darwin18.6.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -color-diagnostics -module-name alias -o /var/folders/20/skxxz6xs12z6t9z90cw56yn40000gn/T/Alias-de4432.o 
0  swift                    0x000000010cfdeee3 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010cfde6bc SignalHandler(int) + 348
2  libsystem_platform.dylib 0x00007fff6c326b5d _sigtramp + 29
3  libsystem_platform.dylib 0x00007f8329718410 _sigtramp + 3175028944
4  swift                    0x0000000109a87467 swift::SILWitnessVisitor<(anonymous namespace)::SILGenConformance>::visitProtocolDecl(swift::ProtocolDecl*) + 183
5  swift                    0x0000000109a86e58 swift::Lowering::SILGenModule::getWitnessTable(swift::ProtocolConformance*) + 504
6  swift                    0x0000000109a8b907 (anonymous namespace)::SILGenType::emitType() + 2871
7  swift                    0x000000010999c67d swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 77
8  swift                    0x000000010999b856 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1206
9  swift                    0x000000010999d66c swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1228
10 swift                    0x0000000108e3e7aa performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 30122
11 swift                    0x0000000108e3392e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
12 swift                    0x0000000108dd19ce main + 1246
13 libdyld.dylib            0x00007fff6c13b3d5 start + 1
14 libdyld.dylib            0x000000000000000f start + 2481736763
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)

On 5.1:

Apple Swift version 5.1 (swiftlang-1100.0.43.3 clang-1100.0.26.3)
Target: x86_64-apple-darwin18.6.0
Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file Alias.swift -target x86_64-apple-darwin18.6.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name alias -o /var/folders/20/skxxz6xs12z6t9z90cw56yn40000gn/T/Alias-38b7eb.o 
1.  While emitting SIL for 'protoFunc()' (at Alias.swift:28:5)
2.  While silgen emitFunction SIL function "@$s5alias8ConcreteV9protoFuncyXe6AType1QaycACyxGAA6ProtoARzlF".
 for 'protoFunc()' (at Alias.swift:28:5)
0  swift                    0x0000000110af8963 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x0000000110af8136 SignalHandler(int) + 358
2  libsystem_platform.dylib 0x00007fff6c326b5d _sigtramp + 29
3  libsystem_platform.dylib 0x00007fc4999b2178 _sigtramp + 761837112
4  swift                    0x000000010cc32a5b swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 3051
5  swift                    0x000000010cbe951b swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 443
6  swift                    0x000000010cb4f2cc swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 1004
7  swift                    0x000000010cc421db (anonymous namespace)::SILGenType::emitType() + 523
8  swift                    0x000000010cb5a8ed swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 77
9  swift                    0x000000010cb59b36 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1238
10 swift                    0x000000010cb5b5bc swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1244
11 swift                    0x000000010c7659f5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 28757
12 swift                    0x000000010c75b0a4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6868
13 swift                    0x000000010c6ea333 main + 1219
14 libdyld.dylib            0x00007fff6c13b3d5 start + 1
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @xymus
Priority Medium

md5: 59316dd9fd58b576f2731ac0720a662e

Issue Description:

Originally, this one was manifesting as a type alias of a nested associated type on a protocol not being found by the compiler.

After trying to nudge the compiler a little by moving the alias out into its own extension, I got a seg 11.

I imagine fixing the seg 11 will resolve not found error – but can split that out as a separate bug if preferred.

struct GenericType<A> {}

protocol ProtoA {
    associatedtype AType1
}

protocol ProtoB {
    // won't be found
//    typealias Alias = AType2.AType1
    associatedtype AType2: ProtoA
    func protoFunc() -> AType2.AType1
}

extension ProtoB {
    // causes seg 11
    typealias Alias = AType2.AType1
}


struct Concrete<AType2: ProtoA>: ProtoB {
    
    func concreteFunc() -> Alias {
        fatalError()
    }
    
    func protoFunc() -> Alias {
        fatalError()
    }
} 
@belkadan
Copy link
Contributor

belkadan commented Jul 1, 2019

With asserts:

Assertion failed: ((HadError || !M.is<SourceFile*>() || M.get<SourceFile*>()->ASTStage < SourceFile::TypeChecked) && "UnresolvedDeclRef" "in wrong phase"), function walkToExprPre, file /Volumes/Data/swift-public/swift/include/swift/AST/ExprNodes.def, line 90.
Stack dump:
0.  Program arguments: /Volumes/Data/swift-public/build/ninja/swift-macosx-x86_64/bin/swift -frontend -interpret - -enable-objc-interop -sdk /Volumes/Data/Applications/Xcode11.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.Internal.sdk -color-diagnostics -module-name main 
1.  Swift version 5.1-dev (LLVM af1f73e9e9, Swift 92c07317ee)
2.  While walking into decl 'Concrete' (at <stdin>:20:1)
3.  While walking into body of 'protoFunc()' (at <stdin>:26:5)

@belkadan
Copy link
Contributor

belkadan commented Jul 1, 2019

@swift-ci create

@slavapestov
Copy link
Member

#26653

@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
Projects
None yet
Development

No branches or pull requests

4 participants