-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
assertion failureBug → crash: An assertion failureBug → crash: An assertion failureownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semantics
Description
Compiling the attached SwiftPM project results in an assertion failure.
The overall structure of the project is
CAPI.h
typedef struct {
} indexstore_string_ref_t;Test.swift
import CAPI
struct IndexStoreUnitDependency: ~Escapable {
@inlinable
var name: IndexStoreStringRef {
@_lifetime(borrow self)
borrowing get {
let a = unit_dependency_get_name()
let stringRef = IndexStoreStringRef(a)
return _overrideLifetime(stringRef, borrowing: self)
}
}
}
struct IndexStoreStringRef: ~Escapable {
private let span: RawSpan
init(_ stringRef: indexstore_string_ref_t) {
fatalError()
}
}
func unit_dependency_get_name() -> indexstore_string_ref_t {
fatalError()
}This can be worked around by changing the parameter of IndexStoreStringRef.init from indexstore_string_ref_t to borrowing indexstore_string_ref_t.
Stack trace
. Apple Swift version 6.3-dev (LLVM bff1370bd79c983, Swift 57cf4ce563f700b)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/private/var/folders/6g/w8x1jq613lxb8rywcsr6c2sr0000gn/T/tmp.IhC7LyRGge/Test/Sources/Test/Test.swift")
4. While silgen emitFunction SIL function "@$s4Test24IndexStoreUnitDependencyV4nameAA0bC9StringRefVvg".
for getter for name (at /private/var/folders/6g/w8x1jq613lxb8rywcsr6c2sr0000gn/T/tmp.IhC7LyRGge/Test/Sources/Test/Test.swift:5:7)
Assertion failed: (ownership == ValueOwnership::Shared), function getVariableAddressableBuffer, file SILGenDecl.cpp, line 2352.
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x191dd75b0 __pthread_kill + 8
1 libsystem_pthread.dylib 0x191e11888 pthread_kill + 296
2 libsystem_c.dylib 0x191d168e0 __abort + 132
3 libsystem_c.dylib 0x191d1685c abort + 136
4 libsystem_c.dylib 0x191d15a84 __assert_rtn + 284
5 swift-frontend 0x1081ab508 swift::Lowering::SILGenFunction::getVariableAddressableBuffer(swift::VarDecl*, swift::SILLocation, swift::ValueOwnership) (.cold.17) + 40
6 swift-frontend 0x102e09c0c swift::Lowering::SILGenFunction::getVariableAddressableBuffer(swift::VarDecl*, swift::SILLocation, swift::ValueOwnership) + 2276
7 swift-frontend 0x102db4a68 swift::Lowering::SILGenFunction::tryEmitAddressableParameterAsAddress(swift::Lowering::ArgumentSource&&, swift::ValueOwnership) + 184
8 swift-frontend 0x102dc8460 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) + 116
9 swift-frontend 0x102db9cc0 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, bool, std::__1::optional<swift::AnyFunctionType::Param>) + 324
10 swift-frontend 0x102dc78d8 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern, llvm::ArrayRef<swift::LifetimeDependenceInfo>) + 248
11 swift-frontend 0x102dd2e6c (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 568
12 swift-frontend 0x102dd27d0 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::LifetimeDependenceInfo>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 1088
13 swift-frontend 0x102dbd34c (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 1856
14 swift-frontend 0x102dbba38 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 1880
15 swift-frontend 0x102e1ae00 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, std::__1::optional<swift::SILLocation>) + 160
16 swift-frontend 0x102e06ee0 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) + 1316
17 swift-frontend 0x102e0df68 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Decl*) + 180
18 swift-frontend 0x102eb2e58 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4168
19 swift-frontend 0x102eb1e04 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 24
20 swift-frontend 0x102e4479c swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 436
21 swift-frontend 0x102da8f50 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6328
22 swift-frontend 0x102da9e5c swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 272
23 swift-frontend 0x102da7660 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 192
24 swift-frontend 0x102ec8b24 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
25 swift-frontend 0x103dd7f44 swift::AbstractStorageDecl::visitEmittedAccessors(llvm::function_ref<void (swift::AccessorDecl*)>) const + 104
26 swift-frontend 0x102dac748 swift::Lowering::SILGenModule::visitEmittedAccessors(swift::AbstractStorageDecl*, llvm::function_ref<void (swift::AccessorDecl*)>) + 48
27 swift-frontend 0x102ec8cd4 (anonymous namespace)::SILGenType::visitAbstractStorageDecl(swift::AbstractStorageDecl*) + 140
28 swift-frontend 0x102ec8af8 (anonymous namespace)::SILGenType::visitVarDecl(swift::VarDecl*) + 164
29 swift-frontend 0x102ec5098 (anonymous namespace)::SILGenType::emitType() + 260
30 swift-frontend 0x102ec4f88 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
31 swift-frontend 0x102dacd4c swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 176
32 swift-frontend 0x102dad26c swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 632
33 swift-frontend 0x102eb17d8 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
34 swift-frontend 0x102db13f4 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'()) + 340
35 swift-frontend 0x102dad81c swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 104
36 swift-frontend 0x1027aecd0 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 692
37 swift-frontend 0x1027bf8f4 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
38 swift-frontend 0x1027b2d30 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*, llvm::ArrayRef<char const*>) + 736
39 swift-frontend 0x1027b048c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2424
40 swift-frontend 0x102518dec swift::mainEntry(int, char const**) + 3060
41 dyld 0x191a49d54 start + 7184
Metadata
Metadata
Assignees
Labels
assertion failureBug → crash: An assertion failureBug → crash: An assertion failureownershipFeature: Ownership modifiers and semanticsFeature: Ownership modifiers and semantics