This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix a parsing bug of Blackfin gas
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Fri, 22 Aug 2008 15:23:14 +0800
- Subject: [PATCH] Fix a parsing bug of Blackfin gas
The `.' in NUMBER pattern of Blackfin bfin-lex.l was not escaped, which
made it match "0&0". Such that it reported a syntax error for the
following instruction:
$ cat t.s
r0.l = 0 & 0xffff;
$ bfin-elf-as -o t.o t.s
t.s: Assembler messages:
t.s:1: Error: syntax error. Input text was xffff.
t.s:1: Error:
I have committed this patch to fix this bug.
Jie
* config/bfin-lex.l (NUMBER): Protect special `.'.
testsuite/
* gas/bfin/misc.s: New test.
* gas/bfin/misc.d: New test.
* gas/bfin/bfin.exp: Add misc test.
Index: testsuite/gas/bfin/misc.s
===================================================================
--- testsuite/gas/bfin/misc.s (revision 0)
+++ testsuite/gas/bfin/misc.s (revision 0)
@@ -0,0 +1,6 @@
+ .text
+ .global _misc
+_misc:
+ /* Check "0 & 0xffff" is parsed correctly. */
+ r0.l = 0 & 0xffff;
+
Index: testsuite/gas/bfin/bfin.exp
===================================================================
--- testsuite/gas/bfin/bfin.exp (revision 2771)
+++ testsuite/gas/bfin/bfin.exp (working copy)
@@ -30,6 +30,7 @@
run_dump_test "load"
run_dump_test "logical"
run_dump_test "logical2"
+ run_dump_test "misc"
run_dump_test "move"
run_dump_test "move2"
run_dump_test "parallel"
Index: testsuite/gas/bfin/misc.d
===================================================================
--- testsuite/gas/bfin/misc.d (revision 0)
+++ testsuite/gas/bfin/misc.d (revision 0)
@@ -0,0 +1,9 @@
+#objdump: -d
+#name: misc
+.*: +file format .*
+
+Disassembly of section .text:
+
+00000000 <_misc>:
+ 0: 00 e1 00 00 R0.L = 0x0;.*
+
Index: config/bfin-lex.l
===================================================================
--- config/bfin-lex.l (revision 2771)
+++ config/bfin-lex.l (working copy)
@@ -295,7 +295,7 @@
<KEYWORD>[iI][fF][lL][uU][sS][hH] return IFLUSH;
<KEYWORD>[fF][lL][uU][sS][hH][iI][nN][vV] return FLUSHINV;
<KEYWORD>[fF][lL][uU][sS][hH] return FLUSH;
-([0-9]+)|(0[xX][0-9a-fA-F]+)|([bhfodBHOFD]#[0-9a-fA-F]+)|(0.[0-9]+) {
+([0-9]+)|(0[xX][0-9a-fA-F]+)|([bhfodBHOFD]#[0-9a-fA-F]+)|(0"."[0-9]+) {
yylval.value = parse_int (&yytext);
return NUMBER;
}