[PATCH] gas: Fix \+ expansion for .irp and .irpc
Jan Beulich
jbeulich@suse.com
Wed May 15 07:12:06 GMT 2024
On 15.05.2024 09:04, Fangrui Song wrote:
> From: Fangrui Song <maskray@gcc.gnu.org>
>
> .irp and .irpc receive a null macro_entry. \+ causes a crash after the
> recent \+ support. Restore the previous behavior.
I did actually wonder when seeing the patch, but then came to the (wrong)
conclusion that - without any NULL passed to macro_expand_body() - there
would be no issue. It's imo bad practice to use 0 where NULL is meant.
In any event, the change is okay, maybe with ...
> --- a/gas/macro.c
> +++ b/gas/macro.c
> @@ -854,7 +854,7 @@ macro_expand_body (sb *in, sb *out, formal_entry *formals,
> sprintf (buffer, "%u", macro_number);
> sb_add_string (out, buffer);
> }
> - else if (src < in->len && in->ptr[src] == '+')
> + else if (src < in->len && in->ptr[src] == '+' && macro)
... this switched to
else if (macro && src < in->len && in->ptr[src] == '+')
Jan
More information about the Binutils
mailing list