diff --git a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp --- a/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp +++ b/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp @@ -42,8 +42,19 @@ EXPECT_NE(P, nullptr); EXPECT_LE(Size, malloc_usable_size(P)); EXPECT_EQ(reinterpret_cast(P) % FIRST_32_SECOND_64(8U, 16U), 0U); + + // An update to this warning in Clang now triggers in this line, but it's ok + // because the check is expecting a bad pointer and should fail. +#if defined(__has_warning) && __has_warning("-Wfree-nonheap-object") +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfree-nonheap-object" +#endif EXPECT_DEATH( free(reinterpret_cast(reinterpret_cast(P) | 1U)), ""); +#if defined(__has_warning) && __has_warning("-Wfree-nonheap-object") +#pragma GCC diagnostic pop +#endif + free(P); EXPECT_DEATH(free(P), "");