Valgrind doesn't error out by default which means bootstrap issues like
in PR116945 can easily be missed: pass --exit-errorcode=1 to handle this.

While here, also set --trace-children=yes to cover child processes
of tools invoked during the build.

Note that this only handles tools invoke during the build, it doesn't
cover everything that --enable-checking=valgrind does.

gcc/ChangeLog:
        PR other/116945
        PR other/116947

        * configure: Regenerate.
        * configure.ac (valgrind_cmd): Pass additional options.
---
 gcc/configure    | 2 +-
 gcc/configure.ac | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 5acc42c1e4d9..0a999e609c92 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -7751,7 +7751,7 @@ fi
     as_fn_error $? "*** Cannot find valgrind" "$LINENO" 5
   fi
   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
-  valgrind_command="$valgrind_path -q"
+  valgrind_command="$valgrind_path --trace-children=yes --error-exitcode=1 -q"
 
 $as_echo "#define ENABLE_VALGRIND_CHECKING 1" >>confdefs.h
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23f4884eff9e..9c52061c981c 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -781,7 +781,7 @@ if test x$ac_valgrind_checking != x ; then
     AC_MSG_ERROR([*** Cannot find valgrind])
   fi
   valgrind_path_defines=-DVALGRIND_PATH='\"'$valgrind_path'\"'
-  valgrind_command="$valgrind_path -q"
+  valgrind_command="$valgrind_path --trace-children=yes --error-exitcode=1 -q"
   AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
 [Define if you want to run subprograms and generated programs
    through valgrind (a memory checker).  This is extremely expensive.])
-- 
2.46.2

Reply via email to