Skip to content

Commit c3acbf6

Browse files
authored
[test] Make two sanitize-coverage tests pass with glibc 2.39+
glibc 2.39 added `nonnull` attribute to most libio functions accepting a `FILE*` parameter, including fprintf[1]. The -fsanitize=undefined mode checks the argument to fprintf and has extra counters, not expected by two tests. Specify -fno-sanitize=nonnull-attribute to make the two tests pass. Fix #82883 [1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=64b1a44183a3094672ed304532bedb9acc707554 Pull Request: #84231
1 parent 0d38f21 commit c3acbf6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_inline8bit_counter_default_impl.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
// REQUIRES: has_sancovcc,stable-runtime,linux,x86_64-target-arch
55

6-
// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters,pc-table -o %t
6+
/// In glibc 2.39+, fprintf has a nonnull attribute. Disable nonnull-attribute,
7+
/// which would increase counters for ubsan.
8+
// RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters,pc-table -fno-sanitize=nonnull-attribute -o %t
79
// RUN: rm -f %t-counters %t-pcs
810
// RUN: env %tool_options="cov_8bit_counters_out=%t-counters cov_pcs_out=%t-pcs verbosity=1" %run %t 2>&1 | FileCheck %s
911

compiler-rt/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
// RUN: rm -rf $DIR
88
// RUN: mkdir -p $DIR
99
// RUN: cd $DIR
10-
// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
10+
/// In glibc 2.39+, fprintf has a nonnull attribute. Disable nonnull-attribute,
11+
/// which would increase counters for ubsan.
12+
// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard -fno-sanitize=nonnull-attribute %s -o %t
1113
// RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
1214
// RUN: rm -rf $DIR
1315

0 commit comments

Comments
 (0)