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-7924] (!ty->hasError() && "Serializing error type") #50459

Closed
tachyonics opened this issue Jun 7, 2018 · 5 comments
Closed

[SR-7924] (!ty->hasError() && "Serializing error type") #50459

tachyonics opened this issue Jun 7, 2018 · 5 comments
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 regression serialization Area → compiler: Serialization & deserialization swift 4.1

Comments

@tachyonics
Copy link

Previous ID SR-7924
Radar rdar://problem/40922122
Original Reporter @tachyonics
Type Bug
Status Closed
Resolution Cannot Reproduce
Environment

Swift version: swift-4.1.2-RELEASE

OS version: macOS 10.12.6

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.1Regression, CompilerCrash, Serialization
Assignee @tachyonics
Priority Medium

md5: b5e626705fcf6903e3077e7e01f82c0e

Issue Description:

This may be a duplicate of https://bugs.swift.org/browse/SR-4317

I upgraded a Swift library to 4.1 and started getting the following error-

Assertion failed: (!ty->hasError() && "Serializing error type"), function addTypeRef, file /Users/buildnode/jenkins/workspace/oss-swift-4.1-package-osx/swift/lib/Serialization/Serialization.cpp, line 617.
0 swift 0x000000010603f3e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010603faf6 SignalHandler(int) + 694
2 libsystem_platform.dylib 0x00007fffcad28b3a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fd9040992d0 _sigtramp + 959907760
4 libsystem_c.dylib 0x00007fffcabad420 abort + 129
5 libsystem_c.dylib 0x00007fffcab74893 basename_r + 0
6 swift 0x00000001039b9578 swift::serialization::Serializer::addTypeRef(swift::Type) + 408
7 swift 0x00000001039c0f01 swift::serialization::Serializer::writeSubstitutions(llvm::ArrayRef<swift::Substitution>, std::__1::array<unsigned int, 256ul> const&, swift::GenericEnvironment*) + 161
8 swift 0x00000001039c05b7 swift::serialization::Serializer::writeNormalConformance(swift::NormalProtocolConformance const*) + 2919
9 swift 0x00000001039d072b swift::serialization::Serializer::writeAllDeclsAndTypes() + 2827
10 swift 0x00000001039d1c9a swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, bool) + 3242
11 swift 0x00000001039d8d4b swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SILModule const*, swift::SerializationOptions const&) + 139
12 swift 0x0000000103a1a8a3 void llvm::function_ref<void (llvm::raw_ostream&)>::callback_fn<swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*)::$_4>(long, llvm::raw_ostream&) + 179
13 swift 0x00000001039d9fa8 withOutputFile(swift::ASTContext&, llvm::StringRef, llvm::function_ref<void (llvm::raw_ostream&)>) + 440
14 swift 0x00000001039d9d6c swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*) + 220
15 swift 0x0000000102afd0e9 std::_1::function::func<performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*)::$_6, std::_1::allocator<performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*)::$_6>, void ()>::operator()() + 617
16 swift 0x000000010372eb64 swift::SILModule::serialize() + 36
17 swift 0x0000000102af5ccd performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 12621
18 swift 0x0000000102af1b90 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3376
19 swift 0x0000000102ab1443 main + 3075
20 libdyld.dylib 0x00007fffcab19235 start + 1
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-4.1.2-RELEASE.xctoolchain/usr/bin/swift -frontend -merge-modules -emit-module /Volumes/Unix/Bugs/EncodingBug/.build/x86_64-apple-macosx10.10/debug/EncodingBug.build/InternalUnkeyedEncodingContainer~partial.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I /Volumes/Unix/Bugs/EncodingBug/.build/x86_64-apple-macosx10.10/debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Volumes/Unix/Bugs/EncodingBug/.build/x86_64-apple-macosx10.10/debug/ModuleCache -swift-version 4 -Onone -D SWIFT_PACKAGE -color-diagnostics -emit-module-doc-path /Volumes/Unix/Bugs/EncodingBug/.build/x86_64-apple-macosx10.10/debug/EncodingBug.swiftdoc -module-name EncodingBug -o /Volumes/Unix/Bugs/EncodingBug/.build/x86_64-apple-macosx10.10/debug/EncodingBug.swiftmodule 
1. While serializing type 'τ_1_0'
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: merge-module command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /Library/Developer/Toolchains/swift-4.1.2-RELEASE.xctoolchain/usr/bin/swift-build-tool -f /Volumes/Unix/Bugs/EncodingBug/.build/debug.yaml main output:

This can be replicated with the following code with the command swift build or building in XCode-

import Foundation

internal class InternalUnkeyedEncodingContainer: UnkeyedEncodingContainer {

    func encode(_ value: String) throws {

    }

    func encode(_ value: Double) throws {

    }  

    func encode(_ value: Float) throws {

    }

    func encode(_ value: Int) throws {

    }

    func encode(_ value: Int8) throws {

    }

    func encode(_ value: Int16) throws {

    }

    func encode(_ value: Int32) throws {

    }

    func encode(_ value: Int64) throws {

    }

    func encode(_ value: UInt) throws {

    }

    func encode(_ value: UInt8) throws {

    }

    func encode(_ value: UInt16) throws {

    }

    func encode(_ value: UInt32) throws {

    }

    func encode(_ value: UInt64) throws {

    }

    func encode<T>(_ value: T) throws where T : Encodable {

    }

    func encode(_ value: Bool) throws {

    }

    var codingPath: [CodingKey] = []

    var count: Int = 0

    func encodeNil() throws {

    }

    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
        fatalError()
    }

    func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {
        fatalError()
    }

    func superEncoder() -> Encoder {
        fatalError()
    }
}
@tachyonics
Copy link
Author

As an additional note, changing the conforming class to a struct seems to resolve the error.

@belkadan
Copy link
Contributor

belkadan commented Jun 8, 2018

Thank you for the reduced test case!

@swift-ci create

@belkadan
Copy link
Contributor

I'm not seeing this happen on near-master. Mind trying with one of the 4.2 snapshots on swift.org?

@belkadan
Copy link
Contributor

Alternately, can you attach a full project where this reproduces, so that I can be sure we have the same setup?

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Jul 23, 2019

@tachyonics We could not reproduce. Closing this but feel free to reopen with more info on how to reproduce.

@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 regression serialization Area → compiler: Serialization & deserialization swift 4.1
Projects
None yet
Development

No branches or pull requests

3 participants