[PATCH] gas: Fix \+ expansion for .irp and .irpc
Fangrui Song
maskray@google.com
Thu May 16 02:42:01 GMT 2024
On 2024-05-16, Hans-Peter Nilsson wrote:
>> From: Fangrui Song <maskray@google.com>
>> Date: Wed, 15 May 2024 18:30:26 -0700
>
>> On Wed, May 15, 2024 at 5:47 PM Hans-Peter Nilsson <hp@axis.com> wrote:
>> >
>> > > Date: Wed, 15 May 2024 00:04:02 -0700
>> > > From: Fangrui Song <maskray@google.com>
>> >
>> > > 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.
>> >
>> > This patch (your commit b1d28350499d) caused the gas macro
>> > test again to fail for cris-* e.g. cris-elf. Please have a
>> > look. Thanks.
>> >
>> > brgds, H-P
>>
>> Sorry for the breakage. Does this work for you?
>
>No. This test has passed for cris-elf in the past.
>
>IMO you should instead move your recent additions to that
>test to a *new* test. Never *add* to a test-case!
>
>brgds, H-P
Splitting the test requires some work...
How about this patch?
From 7d92e6019f1ec9d467b1017dc681cfe011e67e3e Mon Sep 17 00:00:00 2001
From: Fangrui Song <maskray@gcc.gnu.org>
Date: Wed, 15 May 2024 19:31:18 -0700
Subject: [PATCH] gas: Fix \+ test for ONLY_STANDARD_ESCAPES targets
---
gas/testsuite/gas/macros/count-repeat.d | 2 ++
gas/testsuite/gas/macros/count-repeat.l | 3 +++
gas/testsuite/gas/macros/count-repeat.s | 8 ++++++++
gas/testsuite/gas/macros/count.l | 2 --
gas/testsuite/gas/macros/count.s | 7 -------
gas/testsuite/gas/macros/macros.exp | 3 +++
6 files changed, 16 insertions(+), 9 deletions(-)
create mode 100644 gas/testsuite/gas/macros/count-repeat.d
create mode 100644 gas/testsuite/gas/macros/count-repeat.l
create mode 100644 gas/testsuite/gas/macros/count-repeat.s
diff --git a/gas/testsuite/gas/macros/count-repeat.d b/gas/testsuite/gas/macros/count-repeat.d
new file mode 100644
index 00000000000..93660420300
--- /dev/null
+++ b/gas/testsuite/gas/macros/count-repeat.d
@@ -0,0 +1,2 @@
+#name: Macro counters (count-repeat.d)
+# Tests \+ in .irp/.irpc/.rept
diff --git a/gas/testsuite/gas/macros/count-repeat.l b/gas/testsuite/gas/macros/count-repeat.l
new file mode 100644
index 00000000000..d4728e22c3a
--- /dev/null
+++ b/gas/testsuite/gas/macros/count-repeat.l
@@ -0,0 +1,3 @@
+\+
+\+
+\+
diff --git a/gas/testsuite/gas/macros/count-repeat.s b/gas/testsuite/gas/macros/count-repeat.s
new file mode 100644
index 00000000000..e09666db627
--- /dev/null
+++ b/gas/testsuite/gas/macros/count-repeat.s
@@ -0,0 +1,8 @@
+ .rept 1
+ .print "\+"
+ .endr
+ .print "\+"
+ .endr
+ .irpc i,1
+ .print "\+"
+ .endr
diff --git a/gas/testsuite/gas/macros/count.l b/gas/testsuite/gas/macros/count.l
index ca666ea0195..3418b0bab00 100644
--- a/gas/testsuite/gas/macros/count.l
+++ b/gas/testsuite/gas/macros/count.l
@@ -8,5 +8,3 @@
1
4
2
-\+
-\+
diff --git a/gas/testsuite/gas/macros/count.s b/gas/testsuite/gas/macros/count.s
index 4a5b078ba60..c752ca8367d 100644
--- a/gas/testsuite/gas/macros/count.s
+++ b/gas/testsuite/gas/macros/count.s
@@ -17,10 +17,3 @@
mac1 2
mac2 3
-
- .irp i,1
- .print "\+"
- .endr
- .irpc i,1
- .print "\+"
- .endr
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
index 3108f3fcd56..d5a18e3023c 100644
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -103,3 +103,6 @@ gas_test_error "exit.s" "" ".exitm outside of a macro"
run_list_test altmacro
run_list_test count
+# ONLY_STANDARD_ESCAPES targets reject \+ in .irp/.irpc/.rept.
+setup_xfail "avr-*" "cris-*" "crisv32-*" "msp430-*" "z80-*"
+run_list_test count-repeat
--
2.45.0.rc1.225.g2a3ae87e7f-goog
More information about the Binutils
mailing list