From 068285ea2d888f73c42b64a252b419a5c63199a4 Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Wed, 27 Mar 2024 23:57:40 +0100 Subject: [PATCH] Make ASan and fuzzer test slightly more complex, such that LLVM18 also emits the expected code (seems to optimize away some things for very simple code). --- tests/sanitizers/fsanitize_address.d | 4 ++-- tests/sanitizers/fsanitize_fuzzer.d | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/sanitizers/fsanitize_address.d b/tests/sanitizers/fsanitize_address.d index 6e7b115db83..abf8941efad 100644 --- a/tests/sanitizers/fsanitize_address.d +++ b/tests/sanitizers/fsanitize_address.d @@ -4,12 +4,12 @@ // RUN: %ldc -c -output-ll -g -fsanitize=address,thread -of=%t.tsan.ll %s && FileCheck %s --check-prefix=wTSAN < %t.tsan.ll // RUN: %ldc -c -output-ll -g -fsanitize=address -fsanitize=thread -of=%t.tsan.ll %s && FileCheck %s --check-prefix=wTSAN < %t.tsan.ll -void foo() { +void foo(size_t a) { // wTSAN: call {{.*}}_tsan_func_entry // CHECK: call {{.*}}_asan_stack_malloc // wTSAN: {{(call|invoke)}} {{.*}}_asan_stack_malloc int[10] i; // CHECK: call {{.*}}_asan_report_store // wTSAN: {{(call|invoke)}} {{.*}}_asan_report_store - i[0] = 1; + i[a] = 1; } diff --git a/tests/sanitizers/fsanitize_fuzzer.d b/tests/sanitizers/fsanitize_fuzzer.d index 969f11544c3..4d21448b124 100644 --- a/tests/sanitizers/fsanitize_fuzzer.d +++ b/tests/sanitizers/fsanitize_fuzzer.d @@ -16,9 +16,10 @@ bool FuzzMe(const ubyte* data, size_t dataSize) } // CHECK-LABEL: define{{.*}} @{{.*}}allocInt -void allocInt() { +void allocInt(size_t i) { // wASAN: call {{.*}}_asan_stack_malloc int[10] a; + a[i] = 1; } // CHECK-LABEL: define{{.*}} @{{.*}}foo