From c260e6aa3a7dc3e6794442daacde3ae23f029e0b Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 16 Jan 2019 09:15:02 -0800 Subject: Fix a bug in IR linking (#777) The IR linking logic was recently rewritten to use the (optional) `IRLinkageDecoration`s instead of assuming `IRGlobalVals` always have a mangled name field, and in that process a bug seems to have crept in where in the case that an instruction that would usually quality as a "global value" does *not* have linkage, we were failing to register the instruction we create in the output module as a replacement for the original instruction. This problem affects `static` variables inside of functions, leading to them potentially getting emitted multiple times. --- source/slang/ir-link.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang/ir-link.cpp') diff --git a/source/slang/ir-link.cpp b/source/slang/ir-link.cpp index 586172cb2..25d3b40b6 100644 --- a/source/slang/ir-link.cpp +++ b/source/slang/ir-link.cpp @@ -990,7 +990,7 @@ IRInst* cloneGlobalValueWithLinkage( { // If there is no mangled name, then we assume this is a local symbol, // and it can't possibly have multiple declarations. - return cloneGlobalValueImpl(context, originalVal, IROriginalValuesForClone()); + return cloneGlobalValueImpl(context, originalVal, IROriginalValuesForClone(originalVal)); } // -- cgit v1.2.3