view clang/test/CodeGenCXX/wasm-sanitize-vptr.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: %clang_cc1 -std=c++11 -fsanitize=vptr -emit-llvm %s -o - -triple wasm32-unknown-emscripten | FileCheck %s

struct S {
  virtual ~S() {}
  int a;
};

struct T : S {
  int b;
};

// CHECK-LABEL: @_Z15bad_static_castv
void bad_static_cast() {
  S s;
  // CHECK: br i1 %[[NONNULL:.*]], label %[[CONT:.*]], label %[[MISS:.*]], !prof
  // CHECK: [[MISS]]:
  // CHECK: call void @__ubsan_handle_dynamic_type_cache_miss_abort
  // CHECK: [[CONT]]:
  T &r = static_cast<T &>(s);
}