[llvm] 7f07c4d - [SanitizerCoverage] Fix wrong pointer type return from CreateSecStartEnd()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 9 23:29:10 PST 2022
Author: Wu, Yingcong
Date: 2022-11-09T23:29:04-08:00
New Revision: 7f07c4d5134e32787e89ff1d8e6f7a680a40dbd8
URL: https://github.com/llvm/llvm-project/commit/7f07c4d5134e32787e89ff1d8e6f7a680a40dbd8
DIFF: https://github.com/llvm/llvm-project/commit/7f07c4d5134e32787e89ff1d8e6f7a680a40dbd8.diff
LOG: [SanitizerCoverage] Fix wrong pointer type return from CreateSecStartEnd()
`CreateSecStartEnd()` will return pointer to the input type, so when called with `CreateSecStartEnd(M, SanCovCFsSectionName, IntptrPtrTy)`, `SecStartEnd.first` and `SecStartEnd.second` will have type `IntptrPtrPtrTy`, not `IntptrPtrTy`.
This problem should not impact the functionality and with opaque pointer enable, this will not trigger any alarm. But if runs with `-no-opaque-pointers`, this mismatch pointer type will cause type check assertion in `CallInst::init()` to fail.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D137310
Added:
Modified:
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
index 5cfa520db4eba..697eacfe89bfa 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
@@ -522,7 +522,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
}
if (Ctor && Options.CollectControlFlow) {
- auto SecStartEnd = CreateSecStartEnd(M, SanCovCFsSectionName, IntptrPtrTy);
+ auto SecStartEnd = CreateSecStartEnd(M, SanCovCFsSectionName, IntptrTy);
FunctionCallee InitFunction = declareSanitizerInitFunction(
M, SanCovCFsInitName, {IntptrPtrTy, IntptrPtrTy});
IRBuilder<> IRBCtor(Ctor->getEntryBlock().getTerminator());
More information about the llvm-commits
mailing list