Skip to content

Commit 613eac2

Browse files
committed
[SYCL] Use a copy to avoid invalidated access
This fixes a bug introduced in PR intel#2430 where the iterator might get invalidated between accesses. Signed-off-by: Premanand M Rao <[email protected]>
1 parent c3f5cfb commit 613eac2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -2273,12 +2273,13 @@ void CodeGenModule::EmitDeferred() {
22732273
auto DDI = DeferredDecls.find(AliaseeName);
22742274
// Emit what is aliased first.
22752275
if (DDI != DeferredDecls.end()) {
2276-
llvm::GlobalValue *AliaseeGV = dyn_cast<llvm::GlobalValue>(
2277-
GetAddrOfGlobal(DDI->second, ForDefinition));
2276+
GlobalDecl GD = DDI->second;
2277+
llvm::GlobalValue *AliaseeGV =
2278+
dyn_cast<llvm::GlobalValue>(GetAddrOfGlobal(GD, ForDefinition));
22782279
if (!AliaseeGV)
2279-
AliaseeGV = GetGlobalValue(getMangledName(DDI->second));
2280+
AliaseeGV = GetGlobalValue(getMangledName(GD));
22802281
assert(AliaseeGV);
2281-
EmitGlobalDefinition(DDI->second, AliaseeGV);
2282+
EmitGlobalDefinition(GD, AliaseeGV);
22822283
// Remove the entry just added to the DeferredDeclsToEmit
22832284
// since we have emitted it.
22842285
DeferredDeclsToEmit.pop_back();

0 commit comments

Comments
 (0)