summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/hwasan/TestCases/cfi.cpp
blob: 64847398387cabf28dd89272e784add1210f5116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %clangxx_hwasan -fsanitize=cfi -fno-sanitize-trap=cfi -flto -fvisibility=hidden %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s

// REQUIRES: android

// Smoke test for CFI + HWASAN.

struct A {
  virtual void f();
};

void A::f() {}

int main() {
  // CHECK: control flow integrity check for type {{.*}} failed during cast to unrelated type
  A *a = reinterpret_cast<A *>(reinterpret_cast<void *>(&main));
  (void)a;
}
OpenPOWER on IntegriCloud