https://sourceware.org/bugzilla/show_bug.cgi?id=22912

            Bug ID: 22912
           Summary: .irp variable not expanding if followed by a parameter
                    defined earlier
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: andre.simoesdiasvieira at arm dot com
  Target Milestone: ---

With the following input:
.macro mname op0, op1
.irp p0, _and_, _or_
\op0\p0\op1
.endr
.endm
.syntax unified
.text
mname banana, pear


I would expect the macro to expand to:
banana_and_pear
banana_or_pear

Unfortunately when passing it to arm-none-eabi-as I get:
Error: bad instruction `banana\p0pear'
Error: bad instruction `banana\p0pear'

I have also tried this with \() in between operands, but no luck. FYI, if I
change this to:

.macro mname op0
.irp op1, pear
.irp p0, _and_, _or_
\op0\p0\op1
.endr
.endr
.endm

It still will not work, however, if I move the op1 irp past the p0 irp:
.macro mname op0
.irp p0, _and_, _or_
.irp op1, pear
\op0\p0\op1
.endr
.endr
.endm

then I get the expected:
banana_and_pear
banana_or_pear

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to