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-13589] Assertion failure in PointerUnion: (is<T>() && "Invalid accessor called") #56024

Closed
swift-ci opened this issue Sep 23, 2020 · 1 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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13589
Radar rdar://problem/69440430
Original Reporter Olbo (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 9bf2305ed0b70fc2bb739f4599005aa4

Issue Description:

Tested on Xcode 12 Swift 5.3 and Development Toolchain 2020-09-22.

Segmentation fault: 11 when a function and variable both return Never and have the same name.

Assertion failed: (is<T>() && "Invalid accessor called"), function get, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm-project/llvm/include/llvm/ADT/PointerUnion.h, line 195.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-09-22-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /tmp/MyLibrary/Sources/Filling/EmptyDecoder.swift -emit-module-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder~partial.swiftmodule -emit-module-doc-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder~partial.swiftdoc -emit-module-source-info-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder~partial.swiftsourceinfo -serialize-diagnostics-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder.dia -emit-dependencies-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder.d -emit-reference-dependencies-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder.swiftdeps -target x86_64-apple-macos10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Products/Debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Products/Debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/oliver/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -enable-anonymous-context-mangled-names -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/swift-overrides.hmap -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Products/Debug/include -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/DerivedSources-normal/x86_64 -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/DerivedSources/x86_64 -Xcc -I/Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -Xcc -working-directory/tmp/MyLibrary -target-sdk-version 10.15.6 -parse-as-library -module-name Filling -o /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Build/Intermediates.noindex/Enamel.build/Debug/Filling.build/Objects-normal/x86_64/EmptyDecoder.o -index-store-path /Users/oliver/Library/Developer/Xcode/DerivedData/MyLibrary-bcumsulgohwueocqjsbfhkvnieap/Index/DataStore -index-system-modules 
1.  Apple Swift version 5.3-dev (LLVM 2685951d827b16e, Swift ec72db1d8ab63fa)
2.  While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/tmp/MyLibrary/Sources/Filling/EmptyDecoder.swift")
3.  While silgen emitFunction SIL function "@$s7Filling4TestV3foos24UnkeyedDecodingContainer_pyKF".
 for 'foo()' (at /tmp/MyLibrary/Sources/Filling/EmptyDecoder.swift:19:12)
0  swift-frontend           0x0000000106bff435 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x0000000106bfe695 llvm::sys::RunSignalHandlers() + 85
2  swift-frontend           0x0000000106bffa06 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff687195fd _sigtramp + 29
4  libsystem_platform.dylib 0x000000010fabe107 _sigtramp + 18446603343321778983
5  libsystem_c.dylib        0x00007fff685ef808 abort + 120
6  libsystem_c.dylib        0x00007fff685eeac6 err + 0
7  swift-frontend           0x0000000106da7923 swift::Lowering::SILGenModule::useConformance(swift::ProtocolConformanceRef) (.cold.1) + 35
8  swift-frontend           0x000000010295bb20 swift::Lowering::SILGenModule::useConformance(swift::ProtocolConformanceRef) + 544
9  swift-frontend           0x0000000102916fdc swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool) + 108
10 swift-frontend           0x000000010294042a swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 25386
11 swift-frontend           0x000000010292c535 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 309
12 swift-frontend           0x00000001029ae1b6 swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 758
13 swift-frontend           0x00000001029aa5b4 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 6484
14 swift-frontend           0x00000001029aea96 (anonymous namespace)::StmtEmitter::visitBraceStmt(swift::BraceStmt*) + 326
15 swift-frontend           0x00000001029a8c55 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
16 swift-frontend           0x000000010295506c swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 348
17 swift-frontend           0x00000001028c7997 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 5767
18 swift-frontend           0x00000001028c95e4 emitOrDelayFunction(swift::Lowering::SILGenModule&, swift::SILDeclRef, bool) + 228
19 swift-frontend           0x00000001028c62fa swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 122
20 swift-frontend           0x00000001029b8312 swift::ASTVisitor<(anonymous namespace)::SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 626
21 swift-frontend           0x00000001029b53eb (anonymous namespace)::SILGenType::emitType() + 715
22 swift-frontend           0x00000001029b5119 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
23 swift-frontend           0x00000001028cbaa7 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1959
24 swift-frontend           0x00000001029a8750 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 128
25 swift-frontend           0x00000001028d0611 llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 497
26 swift-frontend           0x00000001028ccfbe llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::operator()<swift::ASTLoweringRequest, (void*)0>(swift::ASTLoweringRequest const&) + 110
27 swift-frontend           0x00000001028cd0c3 swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&) + 147
28 swift-frontend           0x000000010255df02 performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 226
29 swift-frontend           0x000000010255640b swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4827
30 swift-frontend           0x00000001024eed62 main + 866
31 libdyld.dylib            0x00007fff68520cc9 start + 1
32 libdyld.dylib            0x0000000000000048 start + 18446603338765955968

Minimal reproduction:

public var UNIMPLEMENTED: Never { fatalError("UNIMPLEMENTED") }


public func UNIMPLEMENTED(
    function: String = #function,
    file: StaticString = #file,
    line: UInt = #line
) -> Never {
    fatalError("UNIMPLEMENTED ← \(function)", file: file, line: line)
}


public struct Test {
    public func foo() throws -> UnkeyedDecodingContainer {
        UNIMPLEMENTED()
    }
}
@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
AnthonyLatsis added a commit to AnthonyLatsis/swift that referenced this issue May 1, 2022
swift-ci added a commit that referenced this issue May 24, 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
Projects
None yet
Development

No branches or pull requests

3 participants