diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -2358,9 +2358,9 @@ GlobalValue::LinkageTypes Linkage = G->getLinkage(); if (G->isConstant() && Linkage == GlobalValue::PrivateLinkage) Linkage = GlobalValue::InternalLinkage; - GlobalVariable *NewGlobal = - new GlobalVariable(M, NewTy, G->isConstant(), Linkage, NewInitializer, - "", G, G->getThreadLocalMode()); + GlobalVariable *NewGlobal = new GlobalVariable( + M, NewTy, G->isConstant(), Linkage, NewInitializer, "", G, + G->getThreadLocalMode(), G->getAddressSpace()); NewGlobal->copyAttributesFrom(G); NewGlobal->setComdat(G->getComdat()); NewGlobal->setAlignment(MaybeAlign(getMinRedzoneSizeForGlobal()));