From 567c7e09b6df36b535c4ffbccd6a3658d18e04c2 Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Tue, 12 Nov 2024 19:46:45 +0200 Subject: Fix two specialization bugs (#5540) * Fix two specialization bugs The first bug was introduced in b2ca2d5a4efeae807d3c3f48f60235e47413b559 and ran some code at scope exit that dereferenced a nullptr context. The second bug was introduced in bea1394ad35680940a0b69b9c67efc43764cc194 and would cause the wrong mangled name to be used during specialization. This closes #5516. * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang/slang-ir-specialize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/slang-ir-specialize.cpp') diff --git a/source/slang/slang-ir-specialize.cpp b/source/slang/slang-ir-specialize.cpp index 81ad5ca2a..2757538a6 100644 --- a/source/slang/slang-ir-specialize.cpp +++ b/source/slang/slang-ir-specialize.cpp @@ -2979,7 +2979,7 @@ IRInst* specializeGenericImpl( builder->setInsertBefore(genericVal); List pendingWorkList; - SLANG_DEFER(for (Index ii = pendingWorkList.getCount() - 1; ii >= 0; ii--) + SLANG_DEFER(for (Index ii = pendingWorkList.getCount() - 1; ii >= 0; ii--) if (context) context->addToWorkList(pendingWorkList[ii]);); // Now we will run through the body of the generic and -- cgit v1.2.3