[flang-commits] [compiler-rt] [libc] [libcxx] [flang] [clang] [libclc] [clang-tools-extra] [llvm] [asan, test] Make alloca_loop_unpoisoning.cpp robust and fix s390x failure (PR #78774)

Fangrui Song via flang-commits flang-commits at lists.llvm.org
Mon Jan 22 08:55:34 PST 2024


https://github.com/MaskRay updated https://github.com/llvm/llvm-project/pull/78774

>From 3833b05746922726eb5a8b512a8a9f5caf7a96c5 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Fri, 19 Jan 2024 12:11:20 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 .../test/asan/TestCases/alloca_loop_unpoisoning.cpp        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp b/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp
index ac25a4faa2dc1b..bf84ab3d20d7de 100644
--- a/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp
+++ b/compiler-rt/test/asan/TestCases/alloca_loop_unpoisoning.cpp
@@ -2,7 +2,6 @@
 // RUN: %env_asan_opts=detect_stack_use_after_return=0 %run %t 2>&1
 //
 // REQUIRES: stable-runtime
-// UNSUPPORTED: target=s390{{.*}}
 
 // This testcase checks that allocas and VLAs inside loop are correctly unpoisoned.
 
@@ -25,11 +24,13 @@ void *top, *bot;
 __attribute__((noinline)) void foo(int len) {
   char x;
   top = &x;
-  char array[len];
+  volatile char array[len];
+  if (len) array[0] = 0;
   assert(!(reinterpret_cast<uintptr_t>(array) & 31L));
   alloca(len);
   for (int i = 0; i < 32; ++i) {
-    char array[i];
+    volatile char array[i];
+    if (i) array[0] = 0;
     bot = alloca(i);
     assert(!(reinterpret_cast<uintptr_t>(bot) & 31L));
   }



More information about the flang-commits mailing list