summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@outlook.com>2021-03-24 13:21:43 -0700
committerAlexey Bataev <a.bataev@outlook.com>2021-03-29 06:55:57 -0700
commitf6f21dcd6c2fa8e44d8c466c5db190aef42beef2 (patch)
tree3246deada713dce4dcb59f1ff52e088d6aed1347 /clang/lib/CodeGen/CodeGenModule.cpp
parent0858f0e09e33f62fc1dcc45e0bdec47eee1e23ba (diff)
[OPENMP]Fix PR49636: Assertion `(!Entry.getAddress() || Entry.getAddress() == Addr) && "Resetting with the new address."' failed.
The original issue is caused by the fact that the variable is allocated with incorrect type i1 instead of i8. This causes the bitcasting of the declaration to i8 type and the bitcast expression does not match the original variable. To fix the problem, the UndefValue initializer and the original variable should be emitted with type i8, not i1. Differential Revision: https://reviews.llvm.org/D99297
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 3a197e85ef7b..f719f009ea99 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -4256,9 +4256,9 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D,
D->getType()->isCUDADeviceBuiltinTextureType());
if (getLangOpts().CUDA &&
(IsCUDASharedVar || IsCUDAShadowVar || IsCUDADeviceShadowVar))
- Init = llvm::UndefValue::get(getTypes().ConvertType(ASTTy));
+ Init = llvm::UndefValue::get(getTypes().ConvertTypeForMem(ASTTy));
else if (D->hasAttr<LoaderUninitializedAttr>())
- Init = llvm::UndefValue::get(getTypes().ConvertType(ASTTy));
+ Init = llvm::UndefValue::get(getTypes().ConvertTypeForMem(ASTTy));
else if (!InitExpr) {
// This is a tentative definition; tentative definitions are
// implicitly initialized with { 0 }.