Skip to content

Compiler Crash when accessing certain members of 'borrowing' Obj-C parameters #82811

Open
@karwa

Description

@karwa

Description

No response

Reproduction

import AVFoundation

func foo(_ x: borrowing AVAudioPCMBuffer) {
    let y = x.frameLength
}

Stack dump

Unhandled SIL Instruction:   %4 = objc_method %3 : $AVAudioPCMBuffer, #AVAudioPCMBuffer.frameLength!getter.foreign : (AVAudioPCMBuffer) -> () -> UInt32, $@convention(objc_method) (AVAudioPCMBuffer) -> UInt32 // user: %6
LLDB diagnostics will be written to /var/folders/8r/4t1jtdv118lcyw2p6wb2dkgw0000gn/T/diagnostics-7fee0d
Please include the directory content when filing a bug report
PLEASE submit a bug report to  and include the crash report from ~/Library/Logs/DiagnosticReports/.
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  lldb                     0x0000000104779bf0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  lldb                     0x000000010477844c llvm::sys::RunSignalHandlers() + 112
2  lldb                     0x000000010477a50c SignalHandler(int) + 320
3  libsystem_platform.dylib 0x0000000181654624 _sigtramp + 56
4  LLDB                     0x000000011a5dc2ec swift::SILInstructionVisitor<(anonymous namespace)::SILMoveOnlyWrappedTypeEliminatorVisitor, bool>::visitAllocPackInst(swift::AllocPackInst*) + 40
5  LLDB                     0x000000011a5dbec0 (anonymous namespace)::SILMoveOnlyWrappedTypeEliminatorPass::run() + 3356
6  LLDB                     0x000000011a5e457c swift::SILPassManager::runPassOnFunction(unsigned int, swift::SILFunction*) + 1404
7  LLDB                     0x000000011a5e531c swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 996
8  LLDB                     0x000000011a5e65fc swift::SILPassManager::execute() + 452
9  LLDB                     0x000000011a5e2708 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 72
10 LLDB                     0x000000011a5e26a8 swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const + 52
11 LLDB                     0x000000011a60e9ac swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 28
12 LLDB                     0x000000011a5f80b8 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'()) + 184
13 LLDB                     0x000000011a5e28ac swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) + 64
14 LLDB                     0x000000011a5fac10 swift::runSILDiagnosticPasses(swift::SILModule&) + 196
15 LLDB                     0x0000000119a796f4 lldb_private::SwiftExpressionParser::Parse(lldb_private::DiagnosticManager&, unsigned int, unsigned int) + 9560
16 LLDB                     0x0000000119a8cc14 lldb_private::SwiftUserExpression::GetTextAndSetExpressionParser(lldb_private::DiagnosticManager&, std::__1::unique_ptr<lldb_private::SwiftExpressionSourceCode, std::__1::default_delete<lldb_private::SwiftExpressionSourceCode>>&, lldb_private::ExecutionContext&, lldb_private::ExecutionContextScope*) + 5480
17 LLDB                     0x0000000119a8d950 lldb_private::SwiftUserExpression::Parse(lldb_private::DiagnosticManager&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool) + 2172
18 LLDB                     0x00000001198fec7c lldb_private::UserExpression::Evaluate(lldb_private::ExecutionContext&, lldb_private::EvaluateExpressionOptions const&, llvm::StringRef, llvm::StringRef, std::__1::shared_ptr<lldb_private::ValueObject>&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, lldb_private::ValueObject*) + 3256
19 LLDB                     0x00000001198fbf9c lldb_private::REPL::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) + 2472
20 LLDB                     0x000000011987a6a0 lldb_private::IOHandlerEditline::Run() + 292
21 LLDB                     0x000000011985c9dc lldb_private::Debugger::RunIOHandlers() + 128
22 LLDB                     0x0000000119862b84 std::__1::__function::__func<lldb_private::Debugger::StartIOHandlerThread()::$_0, std::__1::allocator<lldb_private::Debugger::StartIOHandlerThread()::$_0>, void* ()>::operator()() + 28
23 LLDB                     0x0000000119907d68 lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 132
24 LLDB                     0x0000000119cf6bac lldb_private::HostThreadMacOSX::ThreadCreateTrampoline(void*) + 32
25 libsystem_pthread.dylib  0x000000018161ac0c _pthread_start + 136
26 libsystem_pthread.dylib  0x0000000181615b80 thread_start + 8

Expected behavior

If you leave out the 'borrowing' parameter modifier, the call works, no crash. That's what I expect.

Environment

swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)

Also Xcode 26.0

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.crashBug: A crash, i.e., an abnormal termination of softwaremove-onlyFeature → type declarations: Move-only type declarationsnoncopyable struct/enumFeature → declarations: Noncopyable value type declarationstriage neededThis issue needs more specific labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions