20 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 8int *p[3];9 10int main() {11 for (int i = 0; i < 3; i++) {12 int x;13 p[i] = &x;14 }15 return **p; // BOOM16 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch17 // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]18 // CHECK: Cause: stack tag-mismatch19}20