forked from OSchip/llvm-project
[SanitizerCoverage] Fix global type check with opaque pointers
The code was previously relying on the fact that an incorrectly typed global would result in the insertion of a BitCast constant expression. With opaque pointers, this is no longer the case, so we should check the type explicitly.
This commit is contained in:
parent
69937a8080
commit
c4de78e91c
|
@ -469,7 +469,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
|
|||
Constant *SanCovLowestStackConstant =
|
||||
M.getOrInsertGlobal(SanCovLowestStackName, IntptrTy);
|
||||
SanCovLowestStack = dyn_cast<GlobalVariable>(SanCovLowestStackConstant);
|
||||
if (!SanCovLowestStack) {
|
||||
if (!SanCovLowestStack || SanCovLowestStack->getValueType() != IntptrTy) {
|
||||
C->emitError(StringRef("'") + SanCovLowestStackName +
|
||||
"' should not be declared by the user");
|
||||
return true;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
; RUN: -sanitizer-coverage-stack-depth -S 2>&1 -enable-new-pm=0 | FileCheck %s
|
||||
; RUN: not opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=1 \
|
||||
; RUN: -sanitizer-coverage-stack-depth -S 2>&1 | FileCheck %s
|
||||
; RUN: not opt < %s -passes='module(sancov-module)' -sanitizer-coverage-level=1 \
|
||||
; RUN: -sanitizer-coverage-stack-depth -force-opaque-pointers -S 2>&1 | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
|
Loading…
Reference in New Issue