[PATCH] binutils: fix C23 -Wdiscarded-qualifiers errors

Andreas Schwab schwab@linux-m68k.org
Fri Feb 13 17:00:58 GMT 2026


On Feb 13 2026, simon.marchi@polymtl.ca wrote:

> diff --git a/binutils/prdbg.c b/binutils/prdbg.c
> index 287083df1b92..e307e330a642 100644
> --- a/binutils/prdbg.c
> +++ b/binutils/prdbg.c
> @@ -2655,7 +2655,9 @@ tg_start_function (void *p, const char *name, bool global)
>  	  info->stack->method = xstrdup ("");
>  	  name = dname;
>  	}
> -      sep = strchr (name, '(');
> +      /* This cast is safe: NAME points into the mutable DNAME buffer in
> +	 both branches above.  */
> +      sep = strchr ((char *) name, '(');

Thus name should be replaced by an unqualified pointer that is set in
both branches.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


More information about the Binutils mailing list