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-9233] Crash while emitting IR SIL for SwiftProtobuf with latest dev snapshot #51721

Closed
allevato opened this issue Nov 13, 2018 · 2 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

@allevato
Copy link
Collaborator

Previous ID SR-9233
Radar None
Original Reporter @allevato
Type Bug
Status Resolved
Resolution Done
Environment

Observed on both macOS 10.13 and Linux with the latest (November 1, 2018) trunk snapshot: https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2018-11-01-a/swift-DEVELOPMENT-SNAPSHOT-2018-11-01-a-osx.pkg

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

md5: ab5f65f2457995ff69533b8e65881027

Issue Description:

Oddly, this crash only occurs when using the one-frontend-job-per-file mode. The build succeeds with WMO or when using batch mode. (Hence compiling manually below instead of using swift build.)

Steps to reproduce:

  1. git clone https://github.com/apple/swift-protobuf.git

  2. cd swift-protobuf

  3. /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-11-01-a.xctoolchain/usr/bin/swiftc -sdk $(xcrun --show-sdk-path) -module-name SwiftProtobuf -emit-library Sources/SwiftProtobuf/*.swift

The compiler crashes with the following message:

Assertion failed: (accessor && "didn't have expected opaque accessor"), function operator(), file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/AST/Decl.cpp, line 1737.
Stack dump:
1. While emitting IR SIL function "@$s13SwiftProtobuf7MessagePAAE12unpackingAny10extensions7optionsxAA07Google_b1_E0V_AA12ExtensionMap_pSgAA21BinaryDecodingOptionsVtKcfC".1. While emitting IR SIL function "@$s13SwiftProtobuf7MessagePAAE12unpackingAny10extensions7optionsxAA07Google_b1_E0V_AA12ExtensionMap_pSgAA21BinaryDecodingOptionsVtKcfC". for 'init(unpackingAny:extensions:options:)' at Sources/SwiftProtobuf/Message+AnyAdditions.swift:37:10
0  swift                    0x000000010604eef8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010604e175 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010604f502 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff5084af5a _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 2944094400
5  libsystem_c.dylib        0x00007fff505e81ae abort + 127
6  libsystem_c.dylib        0x00007fff505b01ac basename_r + 0
7  swift                    0x0000000103785cac swift::AbstractStorageDecl::visitOpaqueAccessors(llvm::function_ref<void (swift::AccessorDecl*)>) const + 444
8  swift                    0x00000001025e7218 swift::SILWitnessVisitor<(anonymous namespace)::WitnessTableLayout>::visitProtocolDecl(swift::ProtocolDecl*) + 1352
9  swift                    0x00000001025e6916 swift::irgen::TypeConverter::getProtocolInfo(swift::ProtocolDecl*, swift::irgen::ProtocolInfoKind) + 278
10 swift                    0x00000001025ed2d8 swift::irgen::emitWitnessMethodValue(swift::irgen::IRGenFunction&, llvm::Value*, swift::SILDeclRef) + 216
11 swift                    0x00000001025ed530 swift::irgen::emitWitnessMethodValue(swift::irgen::IRGenFunction&, swift::CanType, llvm::Value**, swift::SILDeclRef, swift::ProtocolConformanceRef) + 64
12 swift                    0x000000010265c681 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 32801
13 swift                    0x0000000102650cc2 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 7778
14 swift                    0x000000010255f652 swift::irgen::IRGenerator::emitGlobalTopLevel(bool) + 674
15 swift                    0x000000010262aa0b performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1067
16 swift                    0x000000010262af46 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, llvm::GlobalVariable**) + 86
17 swift                    0x00000001024ba4a1 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13697
18 swift                    0x00000001024b5e8d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3021
19 swift                    0x0000000102467e5e main + 686
20 libdyld.dylib            0x00007fff5053c015 start + 1
21 libdyld.dylib            0x000000000000005c start + 2947301448

Commenting out the body of the initializer the error points to (init(unpackingAny:extensions:options🙂 in Message+AnyAdditions.swift) isn't sufficient to make the error go away, but removing the entire initializer decl does let it succeed.

@belkadan
Copy link
Contributor

cc @rjmccall

Note that you can use the hidden SWIFT_ENABLE_BATCH_MODE build setting to go back to one-frontend-per-file in Xcode.

@rjmccall
Copy link
Member

#20547

@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