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-8110] Serialization assertion hit: (!ty->hasError() && "Serializing error type") #50642

Open
hamishknight opened this issue Jun 26, 2018 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself serialization Area → compiler: Serialization & deserialization

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-8110
Radar None
Original Reporter @hamishknight
Type Bug
Environment

Swift version 4.2-dev (LLVM 9d4565013d, Clang 5f1c2da6c0, Swift d9e046d)
Target: x86_64-apple-darwin17.6.0

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

md5: 7e72d627fe4af85f95dc9ea6a6fe5d96

Issue Description:

Attempting to compile the following in Swift 4 mode (it's fine in Swift 5 mode as we reject the duplicate inheritance with an error):

protocol C : class, AnyObject {}

yields the following:

Assertion failed: (!ty->hasError() && "Serializing error type"), function addTypeRef, file /Users/Hamish/Desktop/swift-dev/swift/lib/Serialization/Serialization.cpp, line 625.
0  swift                    0x0000000105ba18f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x0000000105ba08f7 llvm::sys::RunSignalHandlers() + 39
2  swift                    0x0000000105ba1f72 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff58223f5a _sigtramp + 26
4  swift                    0x0000000106f3fdc0 cmark_strbuf__initbuf + 114443
5  libsystem_c.dylib        0x00007fff57fc11ae abort + 127
6  libsystem_c.dylib        0x00007fff57f891ac basename_r + 0
7  swift                    0x00000001031727a0 swift::serialization::Serializer::addTypeRef(swift::Type) + 416
8  swift                    0x00000001031826ec swift::serialization::Serializer::writeDecl(swift::Decl const*) + 10908
9  swift                    0x000000010318b642 swift::serialization::Serializer::writeAllDeclsAndTypes() + 3490
10 swift                    0x000000010318cb73 swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, bool) + 3603
11 swift                    0x0000000103193eeb swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SILModule const*, swift::SerializationOptions const&) + 139
12 swift                    0x00000001031d8c03 void llvm::function_ref<void (llvm::raw_ostream&)>::callback_fn<swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*)::$_3>(long, llvm::raw_ostream&) + 179
13 swift                    0x0000000103195148 withOutputFile(swift::ASTContext&, llvm::StringRef, llvm::function_ref<void (llvm::raw_ostream&)>) + 440
14 swift                    0x0000000103194f0c swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*) + 220
15 swift                    0x00000001021881d4 std::__1::__function::__func<performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*)::$_10, std::__1::allocator<performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*)::$_10>, void ()>::operator()() + 500
16 swift                    0x0000000102ec1de4 swift::SILModule::serialize() + 36
17 swift                    0x000000010217e5ec performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 14892
18 swift                    0x0000000102179b5a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3274
19 swift                    0x0000000102134588 main + 1128
20 libdyld.dylib            0x00007fff57f15015 start + 1
Stack dump:
0.  Program arguments: ./swift -frontend -c -primary-file /Users/Hamish/Desktop/main.swift -emit-module-path /dev/null -o /dev/null
1.  While serializing 'C' at /Users/Hamish/Desktop/main.swift:11:1
2.  While serializing type '<<error type>>'
fish: './swift -frontend -c -primary-f…' terminated by signal SIGABRT (Abort)
@belkadan
Copy link
Contributor

That's fun. @slavapestov, @huonw, what type should go here?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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 serialization Area → compiler: Serialization & deserialization
Projects
None yet
Development

No branches or pull requests

2 participants