Index: compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c =================================================================== --- compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c +++ compiler-rt/test/builtins/Unit/compiler_rt_logb_test.c @@ -36,6 +36,11 @@ }; int main() { + // Run the compiler-rt logb test case if the GLIBC + // version is >= 2.23. Older versions of libm may not + // compute to the same value as the compiler-rt value. +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + defined (__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 23) const unsigned N = sizeof(cases) / sizeof(cases[0]); unsigned i; for (i = 0; i < N; ++i) { @@ -57,6 +62,7 @@ if (test__compiler_rt_logb(fromRep(signBit ^ x))) return 1; x >>= 1; } +#endif return 0; } Index: compiler-rt/test/builtins/Unit/divsc3_test.c =================================================================== --- compiler-rt/test/builtins/Unit/divsc3_test.c +++ compiler-rt/test/builtins/Unit/divsc3_test.c @@ -358,6 +358,12 @@ int main() { + + // Run the compiler-rt divsc3 test case if the GLIBC version + // is >= 2.23. There may be some issues and inconsistencies + // with other libm and GCC versions when running this test. +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + defined (__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 23) const unsigned N = sizeof(x) / sizeof(x[0]); unsigned i, j; for (i = 0; i < N; ++i) @@ -368,6 +374,7 @@ return 1; } } +#endif return 0; } Index: compiler-rt/test/builtins/Unit/ppc/qdiv_test.c =================================================================== --- compiler-rt/test/builtins/Unit/ppc/qdiv_test.c +++ compiler-rt/test/builtins/Unit/ppc/qdiv_test.c @@ -9,12 +9,19 @@ int testEdgeCases(); int main(int argc, char *argv[]) { + // Run the compiler-rt ppc/qdiv test case if the GLIBC version + // is >= 2.23. There may be some issues and inconsistencies + // with other libm and GCC versions when running this test. +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + defined (__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 23) if (testEdgeCases()) return 1; if (testAccuracy() > 4.0) return 1; +#endif + return 0; } Index: compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc =================================================================== --- compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc +++ compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc @@ -72,7 +72,13 @@ test(&getpwuid, 0); test(&getpwnam, "root"); test(&getgrgid, 0); + // Run this specific line if the GLIBC version is >= 2.23. + // There may be some issues and inconsistencies with other + // GLIBC versions when running this test. +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + defined (__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 23) test(&getgrnam, any_group.c_str()); +#endif #if !defined(__ANDROID__) setpwent(); @@ -91,7 +97,15 @@ test_r(&getpwnam_r, "root"); test_r(&getgrgid_r, 0); + + + // Run this specific line if the GLIBC version is >= 2.23. + // There may be some issues and inconsistencies with other + // GLIBC versions when running this test. +#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ + defined (__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 23) test_r(&getgrnam_r, any_group.c_str()); +#endif #if defined(__linux__) auto pwd_file = [] {