blob: ed610b3b42495aad0718482b607b7d59877dbb4b [file] [log] [blame]
Ken Russell538bdbc2018-01-25 18:13:071// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/renderer/crash_helpers.h"
6
7#include "base/debug/alias.h"
8
9namespace content {
10
11namespace internal {
12
13NOINLINE void CrashIntentionally() {
14 // NOTE(shess): Crash directly rather than using NOTREACHED() so
15 // that the signature is easier to triage in crash reports.
16 //
17 // Linker's ICF feature may merge this function with other functions with the
18 // same definition and it may confuse the crash report processing system.
19 static int static_variable_to_make_this_function_unique = 0;
20 base::debug::Alias(&static_variable_to_make_this_function_unique);
21
22 volatile int* zero = nullptr;
23 *zero = 0;
24}
25
26NOINLINE void BadCastCrashIntentionally() {
27 class A {
28 virtual void f() {}
29 };
30
31 class B {
32 virtual void f() {}
33 };
34
35 A a;
36 (void)(B*) & a;
37}
38
39} // namespace internal
40
41} // namespace content