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-3500] Compiler crash in extension with same-type constraint #46088
Comments
@swift-ci create |
Comment by Steven Sheldon (JIRA) Is this still on the roadmap to be fixed before 3.1 is released? It's the last regression we're experiencing. I believe the line of code that's triggering the segfault for us used to produce a stack trace like the one in this ticket, but now it produces a different stack trace: Assertion failed: (!substReplacement->hasError() && "substitution replacement failed"), function subst, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/AST/Substitution.cpp, line 59.
0 swift 0x000000010b2be0b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010b2bd2d6 llvm::sys::RunSignalHandlers() + 86
2 swift 0x000000010b2be709 SignalHandler(int) + 361
3 libsystem_platform.dylib 0x00007fffbc28fbba _sigtramp + 26
4 libsystem_platform.dylib 0x00000000b0097338 _sigtramp + 4091574168
5 libsystem_c.dylib 0x00007fffbc116420 abort + 129
6 libsystem_c.dylib 0x00007fffbc0dd893 basename_r + 0
7 swift 0x0000000109135b15 swift::Substitution::subst(swift::ModuleDecl*, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>) const + 1813
8 swift 0x000000010914799c llvm::Optional<swift::Type> llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>::callback_fn<substType(swift::Type, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>, swift::OptionSet<swift::SubstFlags, unsigned int>)::$_14>(long, swift::TypeBase*) + 972
9 swift 0x00000001091448d6 swift::Type::transformRec(llvm::function_ref<llvm::Optional<swift::Type> (swift::TypeBase*)>) const + 166
10 swift 0x0000000109143219 swift::Type::subst(llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>, swift::OptionSet<swift::SubstFlags, unsigned int>) const + 105
11 swift 0x0000000108c60c19 (anonymous namespace)::SILTypeSubstituter::visitType(swift::CanType) + 265
12 swift 0x0000000108c6066e swift::CanType swift::CanTypeVisitor<(anonymous namespace)::SILTypeSubstituter, swift::CanType>::visit<>(swift::CanType) + 94
13 swift 0x0000000108c5af11 (anonymous namespace)::SILTypeSubstituter::visitSILFunctionType(swift::CanTypeWrapper<swift::SILFunctionType>, bool) + 641
14 swift 0x0000000108c6074d swift::CanType swift::CanTypeVisitor<(anonymous namespace)::SILTypeSubstituter, swift::CanType>::visit<>(swift::CanType) + 317
15 swift 0x0000000108c5ab45 swift::SILType::subst(swift::SILModule&, llvm::function_ref<swift::Type (swift::SubstitutableType*)>, llvm::function_ref<llvm::Optional<swift::ProtocolConformanceRef> (swift::CanType, swift::Type, swift::ProtocolType*)>) const + 69
16 swift 0x00000001089ca1f0 swift::TypeSubstCloner<swift::SILInliner>::visitPartialApplyInst(swift::PartialApplyInst*) + 2000
17 swift 0x00000001089bec13 swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 67
18 swift 0x00000001089bf04d swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 1149
19 swift 0x00000001089bf04d swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 1149
20 swift 0x00000001089bf04d swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 1149
21 swift 0x00000001089bf04d swift::SILCloner<swift::SILInliner>::visitSILBasicBlock(swift::SILBasicBlock*) + 1149
22 swift 0x00000001089be625 swift::SILInliner::inlineFunction(swift::FullApplySite, llvm::ArrayRef<swift::SILValue>) + 1141
23 swift 0x0000000108a4b2b1 runOnFunctionRecursively(swift::SILFunction*, swift::FullApplySite, swift::SILOptions::LinkingMode, llvm::DenseSet<swift::SILFunction*, llvm::DenseMapInfo<swift::SILFunction*> >&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfo<swift::SILFunction*> >::Factory&, llvm::ImmutableSet<swift::SILFunction*, llvm::ImutContainerInfo<swift::SILFunction*> >, swift::ClassHierarchyAnalysis*) + 3153
24 swift 0x0000000108a4a488 (anonymous namespace)::MandatoryInlining::run() + 392
25 swift 0x00000001089e063b swift::SILPassManager::runModulePass(swift::SILModuleTransform*) + 1259
26 swift 0x00000001089e1083 swift::SILPassManager::runOneIteration() + 1027
27 swift 0x000000010831468b swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
28 swift 0x00000001089e9725 swift::runSILDiagnosticPasses(swift::SILModule&) + 165
29 swift 0x00000001081cf29c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 12332
30 swift 0x000000010818bd70 main + 3312
31 libdyld.dylib 0x00007fffbc082255 start + 1 |
I submitted a targeted fix to the 3.1 branch: fda2ddb Can you give the next development snapshot a try when it's released? |
Comment by Steven Sheldon (JIRA) @slavapestov you were a step ahead of me 🙂 I just tried the 2017-03-05 snapshot and can confirm that our segfault was fixed. Thanks! |
Environment
Swift 474096b
Additional Detail from JIRA
md5: 4455e3eab37075beeeb65dd78cb6fe48
relates to:
Issue Description:
The following code crashes the compiler on master (regression from 3.0.2). The issue seems to be with the lookup for the return type of A.doSomething (Coordinate.Stride); using a concrete return-type (such as Int) or replacing the constraint with a conformance constraint ("where Coordinate: SignedInteger", for instance) does not crash.
That's as far as I got with my investigation. I think it's related to the TODO in GenericSignature::getSubstitutionMap, but I'm not really familiar with substitution maps so somebody else is probably better-placed to resolve it.
Crash details:
The text was updated successfully, but these errors were encountered: