-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
SILbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwareembeddedEmbedded SwiftEmbedded Swift
Description
Description
When building a snippet that contains variadic generics with swiftc -enable-experimental-feature Embedded -wmo repro.swift with latest development snapshot of the main branch of the toolchain, the compiler crashes in swift::SILCloner.
Reproduction
struct Mixer<each Source: Signal>: Signal {
var sources: (repeat each Source)
mutating func next() -> Float {
var result: Float = 0
sources = (repeat (each sources).next(accumulatingInto: &result))
return result
}
}
protocol Signal {
mutating func next() -> Float
}
extension Signal {
consuming func next(accumulatingInto: inout Float) -> Self {
accumulatingInto += self.next()
return self
}
}
struct Constant: Signal { func next() -> Float { 42 } }
var mixer = Mixer(sources: Constant())
if mixer.next() == 42 {
print("forty two")
} else {
print("not forty two")
}Stack dump
1. Apple Swift version 6.0-dev (LLVM 7fe091223bc821e, Swift 92f5eeeefc88005)
2. Compiling with effective version 5.10
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Non-Diagnostic Mandatory Optimizations, Serialization, Rest of Onone } on SIL for repro)
4. While running pass #342 SILModuleTransform "CrossModuleOptimization".
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x00000001057d2e18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x00000001057d15e4 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001057d3460 SignalHandler(int) + 304
3 libsystem_platform.dylib 0x00000001970e3584 _sigtramp + 56
4 swift-frontend 0x0000000100bfd6bc swift::SILCloner<(anonymous namespace)::InstructionVisitor>::doesOpTupleDisappear(swift::CanTypeWrapper<swift::TupleType>) + 260
5 swift-frontend 0x0000000100bf7208 (anonymous namespace)::InstructionVisitor::makeTypesUsableFromInline(swift::SILInstruction*, (anonymous namespace)::CrossModuleOptimization&) + 11384
6 swift-frontend 0x0000000100bf2f18 (anonymous namespace)::CrossModuleOptimization::serializeFunction(swift::SILFunction*, llvm::DenseMap<swift::SILFunction*, bool, llvm::DenseMapInfo<swift::SILFunction*, void>, llvm::detail::DenseMapPair<swift::SILFunction*, bool>> const&) + 268
7 swift-frontend 0x0000000100bf282c (anonymous namespace)::CrossModuleOptimizationPass::run() + 308
8 swift-frontend 0x0000000100d85e08 swift::SILPassManager::runModulePass(unsigned int) + 856
9 swift-frontend 0x0000000100d88174 swift::SILPassManager::execute() + 624
10 swift-frontend 0x0000000100d829ec swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 72
11 swift-frontend 0x0000000100d8296c swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 68
12 swift-frontend 0x0000000100dbdd68 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 28
13 swift-frontend 0x0000000100d9e63c swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) + 204
14 swift-frontend 0x0000000100d82bc8 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 64
15 swift-frontend 0x0000000100da0d48 swift::runSILPassesForOnone(swift::SILModule&) + 80
16 swift-frontend 0x00000001005edc34 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 252
17 swift-frontend 0x00000001003b3dec performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 796
18 swift-frontend 0x00000001003b3724 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1164
19 swift-frontend 0x00000001003c465c withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
20 swift-frontend 0x00000001003b5b10 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 708
21 swift-frontend 0x00000001003b4a7c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2368
22 swift-frontend 0x00000001001eb4dc swift::mainEntry(int, char const**) + 3096
23 dyld 0x0000000196d2a0e0 start + 2360
Expected behavior
Variadic generics snippet compiles successfully or an actionable diagnostic error message is produced.
Environment
Apple Swift version 6.0-dev (LLVM 7fe091223bc821e, Swift 92f5eee)
Target: arm64-apple-macosx14.0
Additional information
No response
persidskiy, aleksproger and filip-sakel
Metadata
Metadata
Assignees
Labels
SILbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwareembeddedEmbedded SwiftEmbedded Swift