This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thumb32 assembler (61/69)


Minor diagnostic tweak.  If a trailing optional argument set
inst.error, parse_operands would backtrack, throwing that away, and
then issue the generic 'garbage at end of instruction' error.  By not
backtracking over a trailing optional argument that did absorb text,
we preserve the more helpful diagnostic.

zw

	* config/tc-arm.c (parse_operands): Don't backtrack over
	a trailing optional argument that has absorbed text, for
	better diagnostics.

===================================================================
Index: gas/config/tc-arm.c
--- gas/config/tc-arm.c	(revision 63)
+++ gas/config/tc-arm.c	(revision 64)
@@ -3804,6 +3804,14 @@
       if (!backtrack_pos)
 	return FAIL;
 
+      /* Do not backtrack over a trailing optional argument that
+	 absorbed some text.  We will only fail again, with the
+	 'garbage following instruction' error message, which is
+	 probably less helpful than the current one.  */
+      if (backtrack_index == i && backtrack_pos != str
+	  && upat[i+1] == OP_stop)
+	return FAIL;
+
       /* Try again, skipping the optional argument at backtrack_pos.  */
       str = backtrack_pos;
       inst.error = backtrack_error;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]