diff mbox series

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

Message ID e99e28c864e83deb73d9f9858a77ab8350a0a56a.1727923173.git.sam@gentoo.org
State New
Headers show
Series Valgrind checking improvements | expand

Commit Message

Sam James Oct. 3, 2024, 2:39 a.m. UTC
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(-)

Comments

Eric Gallager Oct. 3, 2024, 11:59 a.m. UTC | #1
On Wed, Oct 2, 2024 at 10:43 PM Sam James <sam@gentoo.org> wrote:
>
> 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.

There's a discrepancy here with the values: it's 2 at this point in
the ChangeLog, but 1 in the actual code...

> ---
>  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
>
diff mbox series

Patch

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;