PATCH: Very interesting IA64 gas bug

H. J. Lu hjl@lucon.org
Fri Jun 6 00:39:00 GMT 2003


On Thu, Jun 05, 2003 at 04:56:27PM -0700, H. J. Lu wrote:
> # gunzip hint.s.gz
> # gcc -c hint.s
> hint.s: Assembler messages:
> hint.s:32766: Error: Unknown opcode `hint@pause'
> 
> It seems that gas uses a buffer of size 0x8000. Things will go wrong
> when the input is bigger than 0x8000. I am working on it.
> 

This patch seems to cure the testcase. But I don't know if it is the
right fix nor it covers all cases where the end of the input buffer
is reached. The current code looks fragile to me.


H.J.
-------------- next part --------------
2003-06-05  H.J. Lu <hongjiu.lu@intel.com>

	* app.c (do_scrub_chars): Properly handle reaching the end of
	the input buffer.

--- gas/app.c.overflow	2003-04-24 14:19:07.000000000 -0700
+++ gas/app.c	2003-06-05 17:35:22.000000000 -0700
@@ -1256,7 +1256,17 @@ do_scrub_chars (get, tostart, tolen)
 	      if (len > (toend - to) - 1)
 		len = (toend - to) - 1;
 
-	      if (len > 0)
+	      /* FIXME: We have to handle the case that we reach the
+		 end of buffer.  */
+	      if (len == 0
+		  && fromend == (input_buffer + sizeof input_buffer))
+		{
+		  PUT (ch);
+		  ch = GET ();
+		  PUT (ch);
+		  break;
+		}
+	      else if (len > 0)
 		{
 		  PUT (ch);
 		  if (len > 8)


More information about the Binutils mailing list