diff --git a/src/llvm-late-gc-lowering.cpp b/src/llvm-late-gc-lowering.cpp index e85e181a6cf588..c9a7680b6cdb7a 100644 --- a/src/llvm-late-gc-lowering.cpp +++ b/src/llvm-late-gc-lowering.cpp @@ -1351,8 +1351,9 @@ State LateLowerGCFrame::LocalScan(Function &F) { } if (CI->hasStructRetAttr()) { AllocaInst *SRet = dyn_cast((CI->arg_begin()[0])->stripInBoundsOffsets()); - if (SRet) { - Type *ElT = SRet->getAllocatedType(); + assert(SRet); + { + Type *ElT = (CI->arg_begin()[0])->getType()->getPointerElementType(); if (!(SRet->isStaticAlloca() && isa(ElT) && ElT->getPointerAddressSpace() == AddressSpace::Tracked)) { auto tracked = CountTrackedPointers(ElT); if (tracked.count) { diff --git a/test/compiler/codegen.jl b/test/compiler/codegen.jl index 41e153e93544f1..254548bf6126cb 100644 --- a/test/compiler/codegen.jl +++ b/test/compiler/codegen.jl @@ -433,3 +433,14 @@ const c29864 = VecElement{Union{Int,Nothing}}(2) @noinline g29864() = VecElement{Union{Int,Nothing}}(3) @test f29864().value === 2 @test g29864().value === 3 + +# test sret pointing into a struct containing a tracked pointer +# reduced from TerminalLoggers/ProgressLogging +const _PROGRESS_LOGGING_UUID_NS_test = Base.UUID("1e962757-ea70-431a-b9f6-aadf988dcb7f") +_asuuid_test(id) = Base.uuid5(_PROGRESS_LOGGING_UUID_NS_test, repr(id)) +@noinline _handle_progress_test(progress) = progress +function _handle_message_test() + progress = (_asuuid_test(:id), "name") + return _handle_progress_test(progress) +end +@test _handle_message_test() isa Tuple{Base.UUID, String}