[PATCH 2/2] gcc: make Valgrind errors fatal with --enable-checking=valgrind

Sam James sam@gentoo.org
Thu Oct 3 02:39:33 GMT 2024


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.

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

	* gcc.cc (execute): Pass --error-exitcode=2 to Valgrind.
---
 gcc/gcc.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 16fed46fb35f..cb3c0be77d31 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -3402,12 +3402,13 @@ execute (void)
       for (argc = 0; commands[i].argv[argc] != NULL; argc++)
 	;
 
-      argv = XALLOCAVEC (const char *, argc + 3);
+      argv = XALLOCAVEC (const char *, argc + 4);
 
       argv[0] = VALGRIND_PATH;
       argv[1] = "-q";
-      for (j = 2; j < argc + 2; j++)
-	argv[j] = commands[i].argv[j - 2];
+      argv[2] = "--error-exitcode=1";
+      for (j = 3; j < argc + 3; j++)
+	argv[j] = commands[i].argv[j - 3];
       argv[j] = NULL;
 
       commands[i].argv = argv;
-- 
2.46.2



More information about the Gcc-patches mailing list