Skip to content

Commit 6575ae7

Browse files
authored
[slice] Ensure result is used in test (#31083)
Otherwise sufficiently good compilers may inline SumSlice, see that the result is not used, and discard the code that triggers the crash entirely.
1 parent 52f21ad commit 6575ae7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/core/slice/slice_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ TEST(SliceTest, ExternalAsOwned) {
368368
// In ASAN (where we can be sure that it'll crash), go ahead and read the
369369
// bytes we just deleted.
370370
if (BuiltUnderAsan()) {
371-
ASSERT_DEATH({ SumSlice(slice); }, "");
371+
ASSERT_DEATH({ gpr_log(GPR_DEBUG, "%" PRIdPTR, SumSlice(slice)); }, "");
372372
}
373373
EXPECT_EQ(initial_sum, SumSlice(owned));
374374
}

0 commit comments

Comments
 (0)