[Mlir-commits] [mlir] [hwasan] Fix and re-enable deep-recursion.c (PR #69265)

Paul Kirth llvmlistbot at llvm.org
Mon Oct 16 17:04:22 PDT 2023


================
@@ -29,7 +26,23 @@ void USE(void *x) { // pretend_to_do_something(void *x)
 
 volatile int four = 4;
 
-__attribute__((noinline)) void OOB() { int x[4]; x[four] = 0; USE(&x[0]); }
+__attribute__((noinline)) void OOB() {
+  int x[4];
+  int y[4];
+
+  // Tags for stack-allocated variables can occasionally be zero, resulting in
+  // a false negative for this test. This is not easy to fix, hence we work
+  // around it: if the tag is zero, we use the neighboring variable instead,
+  // which must have a different (hence non-zero) tag.
+  // This tag check assumes aarch64.
+  if(((unsigned long)&x) >> 56 == 0) {
----------------
ilovepi wrote:

Would this be better as `uintptr_t`?

https://github.com/llvm/llvm-project/pull/69265


More information about the Mlir-commits mailing list