// RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
-// REQUIRES: aarch64-target-arch || x86_64-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch
// REQUIRES: pointer-tagging
#include <assert.h>
// https://github.com/google/sanitizers/issues/925
// RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1
-// REQUIRES: aarch64-target-arch || x86_64-target-arch
+// REQUIRES: aarch64-target-arch || x86_64-target-arch || riscv64-target-arch
// REQUIRES: pointer-tagging
#include <assert.h>
// RUN: %run %t
// RUN: %clang_hwasan -O1 -mllvm --aarch64-enable-global-isel-at-O=1 %s -o %t
// RUN: %run %t
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
+
+// This test relies on aarch64 option thus it fails for risc-v
+// XFAIL: riscv64-target-arch
static int global;
// REQUIRES: stable-runtime
// Stack short granules are currently not implemented on x86.
-// XFAIL: x86_64
+// RISC-V target doesn't support oldrt
+// XFAIL: x86_64, riscv64
#include <stdlib.h>
#include <sanitizer/hwasan_interface.h>
__attribute__((noinline)) char buggy() {
char *volatile p;
{
- char zzz[0x1000];
+ char zzz[0x1000] = {};
p = zzz;
}
return *p;
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK
// REQUIRES: stable-runtime
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
#include <sanitizer/hwasan_interface.h>
#include <stdio.h>
// RUN: %clangxx_hwasan_oldrt -static-libstdc++ %s -mllvm -hwasan-instrument-landing-pads=0 -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=BAD
// C++ tests on x86_64 require instrumented libc++/libstdc++.
+// RISC-V target doesn't support oldrt
// REQUIRES: aarch64-target-arch
#include <stdexcept>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope --std=c++11 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <functional>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <stdio.h>
// Function jumps over variable initialization making lifetime analysis
// ambiguous. Asan should ignore such variable and program must not fail.
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <stdlib.h>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
int *p;
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O2 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
int *arr;
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
volatile int *p;
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <stdlib.h>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
int *p[3];
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && %run %t
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <stdio.h>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-stack-safety=0 -mllvm -hwasan-use-after-scope -O2 %s -o %t && \
// RUN: %run %t 2>&1
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <sanitizer/hwasan_interface.h>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -std=c++11 -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
struct IntHolder {
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -std=c++11 -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
struct IntHolder {
// RUN: not %run %t-noexcept 9 2>&1 | FileCheck %s
// RUN: not %run %t-noexcept 10 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
#include <stdlib.h>
// RUN: %clangxx_hwasan -mllvm -hwasan-use-after-scope -O1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// REQUIRES: aarch64-target-arch
+// REQUIRES: aarch64-target-arch || riscv64-target-arch
// REQUIRES: stable-runtime
volatile int *p = 0;