brintos

brintos / llvm-project-archived public Read only

0
0
Text · 546 B · 85fa63d Raw
21 lines · cpp
1// This is the ASAN test of the same name ported to HWAsan.2 3// RUN: %clangxx_hwasan -O1 %s -o %t && \4// RUN:     not %run %t 2>&1 | FileCheck %s5 6// REQUIRES: aarch64-target-arch || riscv64-target-arch7 8volatile int *p;9 10int main() {11  // Variable goes in and out of scope.12  for (int i = 0; i < 3; ++i) {13    int x[3] = {i, i, i};14    p = x + i;15  }16  return *p; // BOOM17  // CHECK: ERROR: HWAddressSanitizer: tag-mismatch18  // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-loop-bug.cpp:[[@LINE-2]]19  // CHECK: Cause: stack tag-mismatch20}21