1// RUN: %clang_hwasan %s -o %t
2// RUN: %run %t
3// RUN: %clang_hwasan -O1 %s -o %t
4// RUN: %run %t
5// RUN: %clang_hwasan -O1 -mllvm --aarch64-enable-global-isel-at-O=1 %s -o %t
6// RUN: %run %t
7// REQUIRES: aarch64-target-arch || riscv64-target-arch
8
9// This test relies on aarch64 option thus it fails for risc-v
10// XFAIL: riscv64-target-arch
11
12static int global;
13
14__attribute__((optnone)) int *address_of_global() { return &global; }
15
16int main(int argc, char **argv) {
17 int *global_address = address_of_global();
18 *global_address = 13;
19 return 0;
20}
21

source code of compiler-rt/test/hwasan/TestCases/exported-tagged-global.c