From 97cfb41634e5e13061d882bbea5faaef4ba058ce Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 4 Jul 2024 23:12:44 +0200 Subject: [PATCH] Fix GH-14798: Valgrind and address sanitizer are not compatible When configuring PHP with: ./configure --with-valgrind and --enable-address-sanitizer configuration now errors now since these two are not compatible configurations. --- configure.ac | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d539fa8200f59..86f319a98a392 100644 --- a/configure.ac +++ b/configure.ac @@ -1555,12 +1555,18 @@ if test "$PHP_MEMORY_SANITIZER" = "yes"; then ], [AC_MSG_ERROR([MemorySanitizer is not available])]) fi -if test "$PHP_ADDRESS_SANITIZER" = "yes"; then +AS_VAR_IF([PHP_ADDRESS_SANITIZER], [yes], + [AS_VAR_IF([PHP_VALGRIND], [no],, [AC_MSG_ERROR([m4_normalize([ + Valgrind and address sanitizer are not compatible. Either disable Valgrind + (remove --with-valgrind) or disable address sanitizer (remove + --enable-address-sanitizer). + ])])]) + AX_CHECK_COMPILE_FLAG([-fsanitize=address], [ CFLAGS="$CFLAGS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC" CXXFLAGS="$CXXFLAGS -fsanitize=address -DZEND_TRACK_ARENA_ALLOC" ], [AC_MSG_ERROR([AddressSanitizer is not available])]) -fi +]) if test "$PHP_UNDEFINED_SANITIZER" = "yes"; then AX_CHECK_COMPILE_FLAG([-fsanitize=undefined], [