Author: Nikita Popov Date: 2022-04-11T12:08:29+02:00 New Revision: b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4
URL: https://github.com/llvm/llvm-project/commit/b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4 DIFF: https://github.com/llvm/llvm-project/commit/b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4.diff LOG: [CGCall] Check store type in findDominatingStoreToReturnValue() We need to make sure that the stored type matches the return type. Added: Modified: clang/lib/CodeGen/CGCall.cpp clang/test/CodeGenObjC/section-name.m Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index c4d342e3d2aaa..e6a5fd1f4f985 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3228,7 +3228,8 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction &CGF) { // ReturnValue to some other location. auto GetStoreIfValid = [&CGF](llvm::User *U) -> llvm::StoreInst * { auto *SI = dyn_cast<llvm::StoreInst>(U); - if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer()) + if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer() || + SI->getValueOperand()->getType() != CGF.ReturnValue.getElementType()) return nullptr; // These aren't actually possible for non-coerced returns, and we // only care about non-coerced returns on this code path. diff --git a/clang/test/CodeGenObjC/section-name.m b/clang/test/CodeGenObjC/section-name.m index b6b9fa4a59f19..63fad82af4e6e 100644 --- a/clang/test/CodeGenObjC/section-name.m +++ b/clang/test/CodeGenObjC/section-name.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-opaque-pointers -triple thumbv7--windows-itanium -fdeclspec -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s +// RUN: %clang_cc1 -triple thumbv7--windows-itanium -fdeclspec -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s @protocol Protocol - (void) protocol_method; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits