* [patch] Missing error messages for Arm parse errors
@ 2006-03-16 0:49 Paul Brook
2006-04-07 15:18 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: Paul Brook @ 2006-03-16 0:49 UTC (permalink / raw)
To: binutils
I recently noticed that one of the arm operand parsing routines returned FAIL
without setting inst.error. This results in gas silently accepting the
malformed instruction.
Obviously it's preferable to have specific error messages, but it's an easy
mistake to make, and silently generating wrong code is really bad. The patch
below adds a catch-all "syntax error" to catch these cases.
Tested with cross to arm-none-eabi.
Ok?
2006-03-16 Paul Brook <paul@codesourcery.com>
* config/tc-arm.c (parse_operands): Set default error message.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.246
diff -u -p -r1.246 tc-arm.c
--- gas/config/tc-arm.c 10 Mar 2006 17:20:30 -0000 1.246
+++ gas/config/tc-arm.c 16 Mar 2006 00:09:32 -0000
@@ -4130,7 +4139,13 @@ parse_operands (char *str, const unsigne
failure:
if (!backtrack_pos)
- return FAIL;
+ {
+ /* The parse routine should already have set inst.error, but set a
+ defaut here just in case. */
+ if (!inst.error)
+ inst.error = _("syntax error");
+ return FAIL;
+ }
/* Do not backtrack over a trailing optional argument that
absorbed some text. We will only fail again, with the
@@ -4138,7 +4153,11 @@ parse_operands (char *str, const unsigne
probably less helpful than the current one. */
if (backtrack_index == i && backtrack_pos != str
&& upat[i+1] == OP_stop)
- return FAIL;
+ {
+ if (!inst.error)
+ inst.error = _("syntax error");
+ return FAIL;
+ }
/* Try again, skipping the optional argument at backtrack_pos. */
str = backtrack_pos;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Missing error messages for Arm parse errors
2006-03-16 0:49 [patch] Missing error messages for Arm parse errors Paul Brook
@ 2006-04-07 15:18 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-04-07 15:18 UTC (permalink / raw)
To: Paul Brook; +Cc: binutils
Hi Paul,
> 2006-03-16 Paul Brook <paul@codesourcery.com>
>
> * config/tc-arm.c (parse_operands): Set default error message.
Approved - please apply.
Cheers
Nick
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-07 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-16 0:49 [patch] Missing error messages for Arm parse errors Paul Brook
2006-04-07 15:18 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).