Open
Description
Description
No response
Reproduction
struct GPack1<each P, T> {}
struct GPack2<each P> {
struct G<T> {}
}
func test<each T>(
example1: repeat GPack1<repeat each T, each T>,
example2: repeat GPack2<repeat each T>.G<each T>
) {
let _ = (repeat each example1) // Boom
// let _ = (repeat each example2)
}
Stack dump
SIL verification failed: lanewise-substituted pack element type didn't match expected element type
$GPack1<repeat each T, each T>
$GPack1</* shape: each T */ repeat /* level: 1 */ each T, each T>
Verifying instruction:
%0 = argument of bb0 : $*Pack{repeat GPack1<repeat each T, each T>} // users: %13, %2
%11 = dynamic_pack_index %8 of $Pack{repeat GPack1<repeat each T, each T>} // users: %13, %12
%12 = open_pack_element %11 of <each T> at <Pack{repeat each T}>, shape $each T, uuid "AC3A1C82-450D-11EF-9B84-A683E7AEC312" // user: %13
-> %13 = pack_element_get %11 of %0 : $*Pack{repeat GPack1<repeat each T, each T>} as $*GPack1<repeat each T, @pack_element("AC3A1C82-450D-11EF-9B84-A683E7AEC312") each T> // user: %14
%14 = load [trivial] %13 : $*GPack1<repeat each T, @pack_element("AC3A1C82-450D-11EF-9B84-A683E7AEC312") each T>
In function:
// test<each A>(example1:example2:)
sil hidden [ossa] @$s4testAA8example18example2yAA6GPack1VyxxQp_QPxGxQp_AA6GPack2V1GVyxxQp_QP_xGxQptRvzlF : $@convention(thin) <each T> (@pack_guaranteed Pack{repeat GPack1<repeat each T, each T>}, @pack_guaranteed Pack{repeat GPack2<repeat each T>.G<each T>}) -> () {
// %0 "example1" // users: %13, %2
// %1 "example2" // user: %3
bb0(%0 : $*Pack{repeat GPack1<repeat each T, each T>}, %1 : $*Pack{repeat GPack2<repeat each T>.G<each T>}):
debug_value %0 : $*Pack{repeat GPack1<repeat each T, each T>}, let, name "example1", argno 1, expr op_deref // id: %2
debug_value %1 : $*Pack{repeat GPack2<repeat each T>.G<each T>}, let, name "example2", argno 2, expr op_deref // id: %3
%4 = integer_literal $Builtin.Word, 0 // user: %7
%5 = integer_literal $Builtin.Word, 1 // user: %15
%6 = pack_length $Pack{repeat each T} // user: %9
br bb1(%4 : $Builtin.Word) // id: %7
// %8 // users: %15, %11, %9
bb1(%8 : $Builtin.Word): // Preds: bb2 bb0
%9 = builtin "cmp_eq_Word"(%8 : $Builtin.Word, %6 : $Builtin.Word) : $Builtin.Int1 // user: %10
cond_br %9, bb3, bb2 // id: %10
bb2: // Preds: bb1
%11 = dynamic_pack_index %8 of $Pack{repeat GPack1<repeat each T, each T>} // users: %13, %12
%12 = open_pack_element %11 of <each T> at <Pack{repeat each T}>, shape $each T, uuid "AC3A1C82-450D-11EF-9B84-A683E7AEC312" // user: %13
%13 = pack_element_get %11 of %0 : $*Pack{repeat GPack1<repeat each T, each T>} as $*GPack1<repeat each T, @pack_element("AC3A1C82-450D-11EF-9B84-A683E7AEC312") each T> // user: %14
%14 = load [trivial] %13 : $*GPack1<repeat each T, @pack_element("AC3A1C82-450D-11EF-9B84-A683E7AEC312") each T>
%15 = builtin "add_Word"(%8 : $Builtin.Word, %5 : $Builtin.Word) : $Builtin.Word // user: %16
br bb1(%15 : $Builtin.Word) // id: %16
bb3: // Preds: bb1
%17 = tuple () // user: %18
return %17 : $() // id: %18
} // end sil function '$s4testAA8example18example2yAA6GPack1VyxxQp_QPxGxQp_AA6GPack2V1GVyxxQp_QP_xGxQptRvzlF'
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: bin/swift-frontend /Users/mac/Desktop/test.swift -debug-diagnostic-names -emit-sil
1. Swift version 6.0-dev (LLVM c7c87ee42989d4b, Swift 8493312b06605f1)
2. Compiling with effective version 5.10
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for module test)
4. While silgen emitFunction SIL function "@$s4testAA8example18example2yAA6GPack1VyxxQp_QPxGxQp_AA6GPack2V1GVyxxQp_QP_xGxQptRvzlF".
for 'test(example1:example2:)' (at /Users/mac/Desktop/test.swift:287:1)
5. While verifying SIL function "@$s4testAA8example18example2yAA6GPack1VyxxQp_QPxGxQp_AA6GPack2V1GVyxxQp_QP_xGxQptRvzlF".
for 'test(example1:example2:)' (at /Users/mac/Desktop/test.swift:287:1)
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 0x0000000113c721b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
1 swift-frontend 0x0000000113c70605 llvm::sys::RunSignalHandlers() + 85
2 swift-frontend 0x0000000113c7280e SignalHandler(int) + 270
3 libsystem_platform.dylib 0x00007ff80d870fdd _sigtramp + 29
4 swift-frontend 0x000000010b041fd5 void std::__1::__libcpp_operator_delete[abi:v160006]<void*>(void*) + 21
5 libsystem_c.dylib 0x00007ff80d767a79 abort + 126
6 swift-frontend 0x000000010d78a2b7 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 919
7 swift-frontend 0x000000010d7a78b2 (anonymous namespace)::SILVerifier::requireSameType(swift::SILType, swift::SILType, llvm::Twine const&) + 146
8 swift-frontend 0x000000010d7c3440 (anonymous namespace)::SILVerifier::verifyDynamicPackIndexStructuralEquality(llvm::ArrayRef<swift::CanType>, swift::DynamicPackIndexInst*, swift::CanType, bool) + 992
9 swift-frontend 0x000000010d7c1823 (anonymous namespace)::SILVerifier::verifyPackElementType(llvm::ArrayRef<swift::CanType>, swift::AnyPackIndexInst*, swift::CanType, bool) + 499
10 swift-frontend 0x000000010d7c6cd0 (anonymous namespace)::SILVerifier::verifyPackElementType(swift::CanTypeWrapper<swift::SILPackType>, swift::AnyPackIndexInst*, swift::SILType) + 288
11 swift-frontend 0x000000010d7c6b7f (anonymous namespace)::SILVerifier::checkPackElementGetInst(swift::PackElementGetInst*) + 159
12 swift-frontend 0x000000010d79ce0e (anonymous namespace)::SILVerifierBase<(anonymous namespace)::SILVerifier>::visitPackElementGetInst(swift::PackElementGetInst*) + 46
13 swift-frontend 0x000000010d796143 swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 2835
14 swift-frontend 0x000000010d794fe7 swift::SILVisitorBase<(anonymous namespace)::SILVerifier, void>::visitSILBasicBlock(swift::SILBasicBlock*) + 135
15 swift-frontend 0x000000010d794a41 (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 33
16 swift-frontend 0x000000010d78f073 (anonymous namespace)::SILVerifier::visitSILBasicBlocks(swift::SILFunction*) + 211
17 swift-frontend 0x000000010d78c731 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 2609
18 swift-frontend 0x000000010d784828 (anonymous namespace)::SILVerifier::verify(bool) + 136
19 swift-frontend 0x000000010d7846b5 swift::SILFunction::verify(swift::CalleeCache*, bool, bool, bool) const + 181
20 swift-frontend 0x000000010c15dd94 swift::SILFunction::verifyIncompleteOSSA() const + 36
21 swift-frontend 0x000000010c15cffe swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 446
22 swift-frontend 0x000000010c15a236 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 4614
23 swift-frontend 0x000000010c15d9c5 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 533
24 swift-frontend 0x000000010c159002 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 450
25 swift-frontend 0x000000010c158e2d swift::Lowering::SILGenModule::visitFuncDecl(swift::FuncDecl*) + 29
26 swift-frontend 0x000000010c158af4 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 996
27 swift-frontend 0x000000010c158700 swift::Lowering::SILGenModule::visit(swift::Decl*) + 64
28 swift-frontend 0x000000010c162c44 (anonymous namespace)::SILGenModuleRAII::emitSourceFile(swift::SourceFile*) + 340
29 swift-frontend 0x000000010c1627ef swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 879
30 swift-frontend 0x000000010c3e718e std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 142
31 swift-frontend 0x000000010c3e70a8 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 40
32 swift-frontend 0x000000010c17e9e8 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 264
33 swift-frontend 0x000000010c17e8c8 swift::ASTLoweringRequest::OutputType swift::Evaluator::operator()<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'(), (void*)0>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 40
34 swift-frontend 0x000000010c163404 swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest) + 36
35 swift-frontend 0x000000010c163320 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 256
36 swift-frontend 0x000000010b3798fb swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 283
37 swift-frontend 0x000000010b3aafd3 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_29::operator()(swift::CompilerInstance&) const + 147
38 swift-frontend 0x000000010b3aaf2d bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_29>(long, swift::CompilerInstance&) + 29
39 swift-frontend 0x000000010b3aa2f1 llvm::function_ref<bool (swift::CompilerInstance&)>::operator()(swift::CompilerInstance&) const + 33
40 swift-frontend 0x000000010b3a9288 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 392
41 swift-frontend 0x000000010b3a1645 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1349
42 swift-frontend 0x000000010b37cd86 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 262
43 swift-frontend 0x000000010b37b78a swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2794
44 swift-frontend 0x000000010b037afa run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) + 2410
45 swift-frontend 0x000000010b036737 swift::mainEntry(int, char const**) + 1543
46 swift-frontend 0x000000010b035e02 main + 34
47 dyld 0x00007ff80d4b6366 start + 1942
Abort trap: 6
Expected behavior
Successful compilation.
Environment
Swift version 6.0-dev (LLVM c7c87ee42989d4b, Swift 8493312)
Target: x86_64-apple-macosx14.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
Bug → crash: An assertion failureA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFeature: generic declarations and typesFeature → expressions: Pack expansion expressionsFeature → generics: Parameter packsFeature: types