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

Simon Marchi simon.marchi@polymtl.ca
Fri Feb 13 17:08:37 GMT 2026



On 2026-02-13 12:00, Andreas Schwab wrote:
> 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.

I didn't want to change the logic and risk breaking something, but I can
do that if you prefer.

Simon


More information about the Binutils mailing list