[compiler-rt] compiler-rt: ubsan: Add suppressions test for nested functions (PR #206962)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 02:39:19 PDT 2026
https://github.com/maflcko updated https://github.com/llvm/llvm-project/pull/206962
>From fab11a2ac602645bb14a41ccea1f09a17462fb7b Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
Date: Wed, 1 Jul 2026 14:16:02 +0200
Subject: [PATCH 1/5] compiler-rt: ubsan: Add suppressions test for inlined
functions
---
.../TestCases/Integer/Inputs/make_signed.h | 13 ++++
.../ubsan/TestCases/Integer/Inputs/wrappers.h | 16 +++++
.../suppressions-nested-calls-inline.c | 68 +++++++++++++++++++
.../suppressions-nested-calls-no-inline.c | 58 ++++++++++++++++
4 files changed, 155 insertions(+)
create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/Inputs/make_signed.h
create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/Inputs/make_signed.h b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/make_signed.h
new file mode 100644
index 0000000000000..f5e1db098368a
--- /dev/null
+++ b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/make_signed.h
@@ -0,0 +1,13 @@
+#ifndef TEST__MAKE_SIGNED_H
+#define TEST__MAKE_SIGNED_H
+
+static int my_make_signed(unsigned a) {
+ // Use different return paths so each report location can be distinguished.
+ if (a < 4002222222U)
+ return a;
+ if (a < 4003333333U)
+ return a;
+ return a;
+}
+
+#endif
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
new file mode 100644
index 0000000000000..31fdf451ec4c1
--- /dev/null
+++ b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
@@ -0,0 +1,16 @@
+#ifndef TEST__WRAPPERS_H
+#define TEST__WRAPPERS_H
+
+#include "make_signed.h"
+
+int my_wrapper(unsigned a) {
+ return my_make_signed(a);
+}
+
+int my_wrapper_2(unsigned a) {
+ volatile int test = a;
+ (void)test;
+ return my_make_signed(a);
+}
+
+#endif
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
new file mode 100644
index 0000000000000..a60b76e351ce8
--- /dev/null
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
@@ -0,0 +1,68 @@
+// REQUIRES: can-symbolize
+// UNSUPPORTED: android
+
+// # Companion test for UBSan suppressions with -finline.
+// # This variant intentionally differs from the -fno-inline baseline.
+//
+// RUN: %clang -fsanitize=integer -fsanitize-recover=integer -O1 -finline -g %s -o %t
+//
+// # Only the directly suppressed my_make_signed hit should disappear.
+//
+// RUN: echo "implicit-integer-sign-change:my_make_signed" > %t.make_signed.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED-INLINE-NAME
+// RUN: echo "implicit-integer-sign-change:Inputs/make_signed.h" > %t.make_signed.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
+//
+// # Only the suppressed wrapper-originated hit should disappear.
+//
+// RUN: echo "implicit-integer-sign-change:my_wrapper_2" > %t.wrapper_2.name.supp
+// RUN: echo "implicit-integer-sign-change:my_wrapper" > %t.wrapper.name.supp
+// RUN: cat %t.wrapper.name.supp %t.wrapper_2.name.supp > %t.wrappers.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+// RUN: echo "implicit-integer-sign-change:Inputs/wrappers.h" > %t.wrappers.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+//
+// # Suppress both.
+//
+// RUN: cat %t.make_signed.name.supp %t.wrapper_2.name.supp > %t.both.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BOTH-INLINE-NAME
+// RUN: cat %t.make_signed.file.supp %t.wrappers.file.supp > %t.both.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
+
+#include "Inputs/make_signed.h"
+#include "Inputs/wrappers.h"
+
+int main(void) {
+ volatile unsigned a1 = 4001111111U;
+ volatile unsigned a2 = 4002222222U;
+ volatile unsigned a3 = 4003333333U;
+ int r1 = my_make_signed(a1);
+ int r2 = my_wrapper(a2);
+ int r3 = my_wrapper_2(a3);
+ return 0;
+}
+
+// The inlined my_make_signed call still produces a report under name-based
+// suppression.
+// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+
+// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
+
+// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
+// CHECK-WRAPPERS: {{.*}}make_signed.h:9:12: runtime error: implicit conversion from type 'unsigned int' of value 4002222222
+// CHECK-WRAPPERS: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-WRAPPERS-NOT: {{.*}}wrappers.h:{{.*}}runtime error:
+
+// The inlined my_make_signed call still produces a report under name-based
+// suppression.
+// CHECK-BOTH-INLINE-NAME: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+
+// CHECK-BOTH-NOT: runtime error:
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
new file mode 100644
index 0000000000000..63aa9cf2eafe9
--- /dev/null
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
@@ -0,0 +1,58 @@
+// REQUIRES: can-symbolize
+// UNSUPPORTED: android
+
+// # Baseline test for UBSan suppressions with -fno-inline.
+//
+// RUN: %clang -fsanitize=integer -fsanitize-recover=integer -O1 -fno-inline -g %s -o %t
+//
+// # Only the directly suppressed my_make_signed hit should disappear.
+//
+// RUN: echo "implicit-integer-sign-change:my_make_signed" > %t.make_signed.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
+// RUN: echo "implicit-integer-sign-change:Inputs/make_signed.h" > %t.make_signed.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
+//
+// # Only the suppressed wrapper-originated hit should disappear.
+//
+// RUN: echo "implicit-integer-sign-change:my_wrapper_2" > %t.wrapper_2.name.supp
+// RUN: echo "implicit-integer-sign-change:my_wrapper" > %t.wrapper.name.supp
+// RUN: cat %t.wrapper.name.supp %t.wrapper_2.name.supp > %t.wrappers.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+// RUN: echo "implicit-integer-sign-change:Inputs/wrappers.h" > %t.wrappers.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+//
+// # Suppress both.
+//
+// RUN: cat %t.make_signed.name.supp %t.wrapper_2.name.supp > %t.both.name.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.name.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
+// RUN: cat %t.make_signed.file.supp %t.wrappers.file.supp > %t.both.file.supp
+// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.file.supp"' \
+// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
+
+#include "Inputs/make_signed.h"
+#include "Inputs/wrappers.h"
+
+int main(void) {
+ volatile unsigned a1 = 4001111111U;
+ volatile unsigned a2 = 4002222222U;
+ volatile unsigned a3 = 4003333333U;
+ int r1 = my_make_signed(a1);
+ int r2 = my_wrapper(a2);
+ int r3 = my_wrapper_2(a3);
+ return 0;
+}
+
+// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
+
+// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
+// CHECK-WRAPPERS: {{.*}}make_signed.h:9:12: runtime error: implicit conversion from type 'unsigned int' of value 4002222222
+// CHECK-WRAPPERS: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-WRAPPERS-NOT: {{.*}}wrappers.h:{{.*}}runtime error:
+
+// CHECK-BOTH-NOT: runtime error:
>From 6d4aa65176ea51286b711c067f73d2c4dd79bfb9 Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
Date: Wed, 1 Jul 2026 14:50:30 +0200
Subject: [PATCH 2/5] clang format
---
compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h | 1 +
.../TestCases/Integer/suppressions-nested-calls-inline.c | 4 ++--
.../TestCases/Integer/suppressions-nested-calls-no-inline.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
index 31fdf451ec4c1..85f7d57620c92 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
+++ b/compiler-rt/test/ubsan/TestCases/Integer/Inputs/wrappers.h
@@ -4,6 +4,7 @@
#include "make_signed.h"
int my_wrapper(unsigned a) {
+ // direct wrapper
return my_make_signed(a);
}
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
index a60b76e351ce8..09eceb7c50a18 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
@@ -50,10 +50,10 @@ int main(void) {
// The inlined my_make_signed call still produces a report under name-based
// suppression.
-// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
index 63aa9cf2eafe9..7ace8f5b56623 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
@@ -47,7 +47,7 @@ int main(void) {
return 0;
}
-// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:11:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
>From 4bd9b78cc9f0a3aaa56d2321f21f11c7cb0a79ca Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
Date: Wed, 1 Jul 2026 15:56:41 +0200
Subject: [PATCH 3/5] UNSUPPORTED: ubsan-tysan // when -finline
---
.../ubsan/TestCases/Integer/suppressions-nested-calls-inline.c | 3 ++-
.../TestCases/Integer/suppressions-nested-calls-no-inline.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
index 09eceb7c50a18..2b745c0742b5d 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
@@ -1,10 +1,11 @@
// REQUIRES: can-symbolize
// UNSUPPORTED: android
+// UNSUPPORTED: ubsan-tysan
// # Companion test for UBSan suppressions with -finline.
// # This variant intentionally differs from the -fno-inline baseline.
//
-// RUN: %clang -fsanitize=integer -fsanitize-recover=integer -O1 -finline -g %s -o %t
+// RUN: %clang -fsanitize=integer -O1 -finline -g %s -o %t
//
// # Only the directly suppressed my_make_signed hit should disappear.
//
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
index 7ace8f5b56623..234b8f7a46035 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
@@ -3,7 +3,7 @@
// # Baseline test for UBSan suppressions with -fno-inline.
//
-// RUN: %clang -fsanitize=integer -fsanitize-recover=integer -O1 -fno-inline -g %s -o %t
+// RUN: %clang -fsanitize=integer -O1 -fno-inline -g %s -o %t
//
// # Only the directly suppressed my_make_signed hit should disappear.
//
>From 8a72b34cb5f524b9ae836093eb6add701c232e41 Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
Date: Fri, 10 Jul 2026 17:37:09 +0200
Subject: [PATCH 4/5] Remove the inline test, it can be added back later, when
needed. Just keep the baseline -O0 test to document the current behavior.
---
.../suppressions-nested-calls-inline.c | 69 -------------------
...e.c => suppressions-nested-calls-no-opt.c} | 4 +-
2 files changed, 2 insertions(+), 71 deletions(-)
delete mode 100644 compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
rename compiler-rt/test/ubsan/TestCases/Integer/{suppressions-nested-calls-no-inline.c => suppressions-nested-calls-no-opt.c} (95%)
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
deleted file mode 100644
index 2b745c0742b5d..0000000000000
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-inline.c
+++ /dev/null
@@ -1,69 +0,0 @@
-// REQUIRES: can-symbolize
-// UNSUPPORTED: android
-// UNSUPPORTED: ubsan-tysan
-
-// # Companion test for UBSan suppressions with -finline.
-// # This variant intentionally differs from the -fno-inline baseline.
-//
-// RUN: %clang -fsanitize=integer -O1 -finline -g %s -o %t
-//
-// # Only the directly suppressed my_make_signed hit should disappear.
-//
-// RUN: echo "implicit-integer-sign-change:my_make_signed" > %t.make_signed.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED-INLINE-NAME
-// RUN: echo "implicit-integer-sign-change:Inputs/make_signed.h" > %t.make_signed.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
-//
-// # Only the suppressed wrapper-originated hit should disappear.
-//
-// RUN: echo "implicit-integer-sign-change:my_wrapper_2" > %t.wrapper_2.name.supp
-// RUN: echo "implicit-integer-sign-change:my_wrapper" > %t.wrapper.name.supp
-// RUN: cat %t.wrapper.name.supp %t.wrapper_2.name.supp > %t.wrappers.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
-// RUN: echo "implicit-integer-sign-change:Inputs/wrappers.h" > %t.wrappers.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
-//
-// # Suppress both.
-//
-// RUN: cat %t.make_signed.name.supp %t.wrapper_2.name.supp > %t.both.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BOTH-INLINE-NAME
-// RUN: cat %t.make_signed.file.supp %t.wrappers.file.supp > %t.both.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
-
-#include "Inputs/make_signed.h"
-#include "Inputs/wrappers.h"
-
-int main(void) {
- volatile unsigned a1 = 4001111111U;
- volatile unsigned a2 = 4002222222U;
- volatile unsigned a3 = 4003333333U;
- int r1 = my_make_signed(a1);
- int r2 = my_wrapper(a2);
- int r3 = my_wrapper_2(a3);
- return 0;
-}
-
-// The inlined my_make_signed call still produces a report under name-based
-// suppression.
-// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-MAKE-SIGNED-INLINE-NAME: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-
-// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
-
-// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
-// CHECK-WRAPPERS: {{.*}}make_signed.h:9:12: runtime error: implicit conversion from type 'unsigned int' of value 4002222222
-// CHECK-WRAPPERS: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-WRAPPERS-NOT: {{.*}}wrappers.h:{{.*}}runtime error:
-
-// The inlined my_make_signed call still produces a report under name-based
-// suppression.
-// CHECK-BOTH-INLINE-NAME: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-
-// CHECK-BOTH-NOT: runtime error:
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
similarity index 95%
rename from compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
rename to compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
index 234b8f7a46035..84ed1231d2448 100644
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-inline.c
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
@@ -1,9 +1,9 @@
// REQUIRES: can-symbolize
// UNSUPPORTED: android
-// # Baseline test for UBSan suppressions with -fno-inline.
+// # Baseline test for UBSan suppressions with no optimization.
//
-// RUN: %clang -fsanitize=integer -O1 -fno-inline -g %s -o %t
+// RUN: %clang -fsanitize=integer -O0 -g %s -o %t
//
// # Only the directly suppressed my_make_signed hit should disappear.
//
>From 2e97ba6169456c512b0a2bbeda42cab422f686de Mon Sep 17 00:00:00 2001
From: MarcoFalke <*~=`'#}+{/-|&$^_ at 721217.xyz>
Date: Mon, 13 Jul 2026 11:38:08 +0200
Subject: [PATCH 5/5] rename to suppressions-nested-calls.c
---
.../suppressions-nested-calls-no-opt.c | 58 -------------------
.../Integer/suppressions-nested-calls.c | 50 ++++++++++++++++
2 files changed, 50 insertions(+), 58 deletions(-)
delete mode 100644 compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
create mode 100644 compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls.c
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
deleted file mode 100644
index 84ed1231d2448..0000000000000
--- a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls-no-opt.c
+++ /dev/null
@@ -1,58 +0,0 @@
-// REQUIRES: can-symbolize
-// UNSUPPORTED: android
-
-// # Baseline test for UBSan suppressions with no optimization.
-//
-// RUN: %clang -fsanitize=integer -O0 -g %s -o %t
-//
-// # Only the directly suppressed my_make_signed hit should disappear.
-//
-// RUN: echo "implicit-integer-sign-change:my_make_signed" > %t.make_signed.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
-// RUN: echo "implicit-integer-sign-change:Inputs/make_signed.h" > %t.make_signed.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.make_signed.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
-//
-// # Only the suppressed wrapper-originated hit should disappear.
-//
-// RUN: echo "implicit-integer-sign-change:my_wrapper_2" > %t.wrapper_2.name.supp
-// RUN: echo "implicit-integer-sign-change:my_wrapper" > %t.wrapper.name.supp
-// RUN: cat %t.wrapper.name.supp %t.wrapper_2.name.supp > %t.wrappers.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
-// RUN: echo "implicit-integer-sign-change:Inputs/wrappers.h" > %t.wrappers.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.wrappers.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
-//
-// # Suppress both.
-//
-// RUN: cat %t.make_signed.name.supp %t.wrapper_2.name.supp > %t.both.name.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.name.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
-// RUN: cat %t.make_signed.file.supp %t.wrappers.file.supp > %t.both.file.supp
-// RUN: %env_ubsan_opts=report_error_type=1:print_stacktrace=1:suppressions='"%t.both.file.supp"' \
-// RUN: %run %t 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
-
-#include "Inputs/make_signed.h"
-#include "Inputs/wrappers.h"
-
-int main(void) {
- volatile unsigned a1 = 4001111111U;
- volatile unsigned a2 = 4002222222U;
- volatile unsigned a3 = 4003333333U;
- int r1 = my_make_signed(a1);
- int r2 = my_wrapper(a2);
- int r3 = my_wrapper_2(a3);
- return 0;
-}
-
-// CHECK-MAKE-SIGNED: {{.*}}wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
-
-// CHECK-WRAPPERS: {{.*}}make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
-// CHECK-WRAPPERS: {{.*}}make_signed.h:9:12: runtime error: implicit conversion from type 'unsigned int' of value 4002222222
-// CHECK-WRAPPERS: {{.*}}make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
-// CHECK-WRAPPERS-NOT: {{.*}}wrappers.h:{{.*}}runtime error:
-
-// CHECK-BOTH-NOT: runtime error:
diff --git a/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls.c b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls.c
new file mode 100644
index 0000000000000..282d7a21ba0c5
--- /dev/null
+++ b/compiler-rt/test/ubsan/TestCases/Integer/suppressions-nested-calls.c
@@ -0,0 +1,50 @@
+// REQUIRES: can-symbolize
+// UNSUPPORTED: android
+
+// # Test for UBSan suppressions with nested function calls
+//
+// RUN: %clang -fsanitize=integer -O0 -g %s -o %t.o0
+//
+// # Only the directly suppressed my_make_signed hit should disappear.
+// RUN: echo "implicit-integer-sign-change:my_make_signed" > %t.make_signed.name.supp
+// RUN: echo "implicit-integer-sign-change:Inputs/make_signed.h" > %t.make_signed.file.supp
+//
+// RUN: %env_ubsan_opts=suppressions="%t.make_signed.name.supp" %run %t.o0 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
+// RUN: %env_ubsan_opts=suppressions="%t.make_signed.file.supp" %run %t.o0 2>&1 | FileCheck %s --check-prefix=CHECK-MAKE-SIGNED
+//
+// # Only the suppressed wrapper-originated hit should disappear.
+// RUN: echo "implicit-integer-sign-change:my_wrapper_2" > %t.my_wrapper_2.name.supp
+// RUN: echo "implicit-integer-sign-change:Inputs/wrappers.h" > %t.wrappers.file.supp
+//
+// RUN: %env_ubsan_opts=suppressions="%t.my_wrapper_2.name.supp" %run %t.o0 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+// RUN: %env_ubsan_opts=suppressions="%t.wrappers.file.supp" %run %t.o0 2>&1 | FileCheck %s --check-prefix=CHECK-WRAPPERS
+//
+// # Suppress both.
+// RUN: cat %t.make_signed.name.supp %t.my_wrapper_2.name.supp > %t.both.name.supp
+// RUN: cat %t.make_signed.file.supp %t.wrappers.file.supp > %t.both.file.supp
+//
+// RUN: %env_ubsan_opts=suppressions="%t.both.name.supp" %run %t.o0 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
+// RUN: %env_ubsan_opts=suppressions="%t.both.file.supp" %run %t.o0 2>&1 | FileCheck %s --allow-empty --check-prefix=CHECK-BOTH
+
+#include "Inputs/make_signed.h"
+#include "Inputs/wrappers.h"
+
+int main(void) {
+ volatile unsigned a1 = 4001111111U;
+ volatile unsigned a2 = 4002222222U;
+ volatile unsigned a3 = 4003333333U;
+ int r1 = my_make_signed(a1);
+ int r2 = my_wrapper(a2);
+ int r3 = my_wrapper_2(a3);
+ return 0;
+}
+
+// CHECK-MAKE-SIGNED: wrappers.h:12:23: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-MAKE-SIGNED-NOT: make_signed.h:{{.*}}runtime error:
+
+// CHECK-WRAPPERS: make_signed.h:7:12: runtime error: implicit conversion from type 'unsigned int' of value 4001111111
+// CHECK-WRAPPERS: make_signed.h:9:12: runtime error: implicit conversion from type 'unsigned int' of value 4002222222
+// CHECK-WRAPPERS: make_signed.h:10:10: runtime error: implicit conversion from type 'unsigned int' of value 4003333333
+// CHECK-WRAPPERS-NOT: wrappers.h:{{.*}}runtime error:
+
+// CHECK-BOTH-NOT: runtime error:
More information about the llvm-commits
mailing list