llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Qinkun Bao (qinkunbao) <details> <summary>Changes</summary> See https://github.com/llvm/llvm-project/issues/139128 If multiple entries match the source, than the latest entry takes the precedence.` --- Full diff: https://github.com/llvm/llvm-project/pull/142456.diff 1 Files Affected: - (added) clang/test/CodeGen/ubsan-global-ignorelist.test (+39) ``````````diff diff --git a/clang/test/CodeGen/ubsan-global-ignorelist.test b/clang/test/CodeGen/ubsan-global-ignorelist.test new file mode 100644 index 0000000000000..8d7812217f331 --- /dev/null +++ b/clang/test/CodeGen/ubsan-global-ignorelist.test @@ -0,0 +1,39 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-0.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-1.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-2.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,IGNORE +// RUN: %clang -target x86_64-unknown-linux-gnu -S -emit-llvm -fsanitize=bounds -fsanitize-ignorelist=%t/order-3.ignorelist %t/test.c -o - | FileCheck %s --check-prefixes=CHECK,SANITIZE + +// The same type can appear multiple times within an ignorelist. Any ``=sanitize`` type +// entries enable sanitizer instrumentation, even if it was ignored by entries before. +// If multiple entries match the source, then the latest entry takes the +// precedence. + +//--- order-0.ignorelist +global:global_array + +//--- order-1.ignorelist +global:global_array +global:global_array=sanitize + +//--- order-2.ignorelist +global:* +global:global_array=sanitize +global:global_array + +//--- order-3.ignorelist +global:* +global:global_array=sanitize +global:global* +global:*array=sanitize + +//--- test.c +unsigned global_array[100] = {-1}; + +// CHECK-LABEL: define dso_local i32 @test +// IGNORE-NOT: call void @__ubsan_handle_out_of_bounds +// SANITIZE: call void @__ubsan_handle_out_of_bounds +int test(int i) { return global_array[i]; } `````````` </details> https://github.com/llvm/llvm-project/pull/142456 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits