[PATCH] gas: Fix \+ expansion for .irp and .irpc
Fangrui Song
maskray@google.com
Wed May 15 22:04:43 GMT 2024
On Wed, May 15, 2024 at 12:12 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> 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
Ack.
While here, I will add .irpc coverage as well.
--
宋方睿
More information about the Binutils
mailing list