29 lines · cpp
1// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \2// RUN: -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK3// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \4// RUN: -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK5// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \6// RUN: -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK7// RUN: %clangxx_hwasan -fomit-frame-pointer -momit-leaf-frame-pointer \8// RUN: -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK9 10// This test ensures that the CFA is implemented properly for slow11// (non-frame-pointer) unwinding.12#include <sanitizer/hwasan_interface.h>13#include <stdio.h>14#include <stdlib.h>15 16__attribute__((noinline)) void f(int *p) { *p = 3; }17 18// CHECK: ERROR: HWAddressSanitizer:19// CHECK: #{{[0-9]}} {{.*}} in f(int*) {{.*}}register-dump-no-fp.cpp:[[@LINE-3]]20 21int main() {22 __hwasan_enable_allocator_tagging();23 24 int *volatile a = new int;25 a = (int *)__hwasan_tag_pointer(a, 0);26 f(a);27 // CHECK: #{{[0-9]}} {{.*}} in main {{.*}}register-dump-no-fp.cpp:[[@LINE-1]]28}29