view compiler-rt/test/hwasan/TestCases/cfi.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
line wrap: on
line source

// 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;
}