aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/macro.c2
-rw-r--r--gas/testsuite/gas/macros/count.l2
-rw-r--r--gas/testsuite/gas/macros/count.s7
3 files changed, 10 insertions, 1 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 72d869d..3036e6a 100644
--- 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 (macro && src < in->len && in->ptr[src] == '+')
{
/* Sub in the current macro invocation number. */
diff --git a/gas/testsuite/gas/macros/count.l b/gas/testsuite/gas/macros/count.l
index 3418b0b..ca666ea 100644
--- a/gas/testsuite/gas/macros/count.l
+++ b/gas/testsuite/gas/macros/count.l
@@ -8,3 +8,5 @@
1
4
2
+\+
+\+
diff --git a/gas/testsuite/gas/macros/count.s b/gas/testsuite/gas/macros/count.s
index c752ca8..4a5b078 100644
--- a/gas/testsuite/gas/macros/count.s
+++ b/gas/testsuite/gas/macros/count.s
@@ -17,3 +17,10 @@
mac1 2
mac2 3
+
+ .irp i,1
+ .print "\+"
+ .endr
+ .irpc i,1
+ .print "\+"
+ .endr