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-11563] IRGen crashes on parsed SIL (output of -emit-silgen) #53968

Open
dan-zheng opened this issue Oct 2, 2019 · 0 comments
Open

[SR-11563] IRGen crashes on parsed SIL (output of -emit-silgen) #53968

dan-zheng opened this issue Oct 2, 2019 · 0 comments
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 SILParser Area → compiler: The SIL parser

Comments

@dan-zheng
Copy link
Collaborator

Previous ID SR-11563
Radar None
Original Reporter @dan-zheng
Type Bug

Attachment: Download

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

md5: 6675997817db77cfd9828a139e8b6b0b

Issue Description:

struct Foo<Scalar> {}
extension Foo: Equatable where Scalar: Equatable {}

swift sr-11563.swift and swiftc sr-11563.swift work as expected.
However, swiftc -emit-silgen sr-11563.swift > sr-11563.sil && swift sr-11563.sil (parsing+compiling the output of SILGen) does not:

Assertion failed: (!type->hasArchetype() && "already have a contextual type"), function mapTypeIntoContext, file /Users/swiftninjas/s4tf/swift/lib/AST/GenericEnvironment.cpp, line 116.
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-09-30-a.xctoolchain/usr/bin/swift -frontend -c -primary-file sr-11563.sil -target x86_64-apple-darwin18.7.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main -o /var/folders/m_/6f7q8zfs3n9fr0c_4gy8840m00hc_q/T/sr-11563-1ac3d6.o
1.  Swift version 5.1-dev (LLVM 200186e28b, Swift 1238976565)
2.  While emitting IR SIL function "@$s4main3FooVyxGSQAASQRzlSQ2eeoiySbx_xtFZTW".
 for sr-11563.sil:55:43
0  swift                    0x00000001111f8715 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x00000001111f7a05 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x00000001111f8cf8 SignalHandler(int) + 264
3  libsystem_platform.dylib 0x00007fff6f4d0b5d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000127288938 _sigtramp + 3084615160
5  libsystem_c.dylib        0x00007fff6f38a6a6 abort + 127
6  libsystem_c.dylib        0x00007fff6f35320d basename_r + 0
7  swift                    0x0000000111672a41 swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) (.cold.1) + 33
8  swift                    0x000000010e6a2c84 swift::GenericEnvironment::mapTypeIntoContext(swift::GenericEnvironment*, swift::Type) + 68
9  swift                    0x000000010d99d700 swift::CanType llvm::function_ref<swift::CanType (swift::CanType)>::callback_fn<(anonymous namespace)::EmitPolymorphicParameters::bindExtraSource(swift::irgen::MetadataSource const&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*)::$_12>(long, swift::CanType) + 16
10 swift                    0x000000010da2ae39 bool llvm::function_ref<bool (unsigned int, swift::CanType, swift::ProtocolDecl*)>::callback_fn<swift::irgen::IRGenFunction::bindLocalTypeDataFromSelfWitnessTable(swift::ProtocolConformance const*, llvm::Value*, llvm::function_ref<swift::CanType (swift::CanType)>)::$_0>(long, unsigned int, swift::CanType, swift::ProtocolDecl*) + 41
11 swift                    0x000000010e17826d swift::SILWitnessTable::enumerateWitnessTableConditionalConformances(swift::ProtocolConformance const*, llvm::function_ref<bool (unsigned int, swift::CanType, swift::ProtocolDecl*)>) + 221
12 swift                    0x000000010da28f8e swift::irgen::IRGenFunction::bindLocalTypeDataFromSelfWitnessTable(swift::ProtocolConformance const*, llvm::Value*, llvm::function_ref<swift::CanType (swift::CanType)>) + 62
13 swift                    0x000000010d997b82 swift::irgen::emitPolymorphicParameters(swift::irgen::IRGenFunction&, swift::SILFunction&, swift::irgen::Explosion&, swift::irgen::WitnessMetadata*, llvm::function_ref<llvm::Value* (unsigned int)> const&) + 754
14 swift                    0x000000010d9f38d0 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 6016
15 swift                    0x000000010d9115cb swift::irgen::IRGenerator::emitLazyDefinitions() + 1243
16 swift                    0x000000010d9cec55 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**) + 1477
17 swift                    0x000000010d9cd460 swift::performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::GlobalVariable**) + 960
18 swift                    0x000000010d87b821 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13233
19 swift                    0x000000010d877540 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3024
@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
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 SILParser Area → compiler: The SIL parser
Projects
None yet
Development

No branches or pull requests

2 participants