1 // RUN: %clangxx_hwasan -mllvm -hwasan-use-stack-safety=0 -O2 %s -o %t && \
4 // REQUIRES: aarch64-target-arch || riscv64-target-arch
6 #include <sanitizer/hwasan_interface.h>
11 #include <sys/types.h>
14 volatile const char *stackbuf
= nullptr;
17 __attribute__((noinline
)) bool jump() {
18 // Fool the compiler so it cannot deduce noreturn.
27 switch (setjmp(jbuf
)) {
47 void *untagged
= __hwasan_tag_pointer(stackbuf
, 0);
48 if (stackbuf
== untagged
) {
49 // The buffer wasn't tagged in the first place, so the test will not work
53 if (__hwasan_test_shadow(untagged
, 4096) != -1) {