public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* a bug in as
@ 1999-07-13 11:28 H.J. Lu
  1999-07-14 17:04 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 1999-07-13 11:28 UTC (permalink / raw)
  To: binutils

Hi,

I got this report. The code is wrong. But as message doesn't help
either. Is there a way for as to report correct line number? Also
it shouldn't be an internal error.


H.J.
---
From okuji@kuicr.kyoto-u.ac.jp  Tue Jul 13 09:08:44 1999
Return-Path: <okuji@kuicr.kyoto-u.ac.jp>
Delivered-To: hjl@lucon.org
Received: from duff.kuicr.kyoto-u.ac.jp (duff.kuicr.kyoto-u.ac.jp [133.103.101.254])
	by ocean.lucon.org (Postfix) with ESMTP id B24C157BA
	for <hjl@lucon.org>; Tue, 13 Jul 1999 09:08:42 -0700 (PDT)
Received: from localhost (okuji@pppD225.kyoto-inet.or.jp [210.134.124.95])
	by duff.kuicr.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id BAA16754
	for <hjl@lucon.org>; Wed, 14 Jul 1999 01:08:04 +0900
To: hjl@lucon.org
Subject: a bug in as
From: OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
X-Mailer: Mew version 1.93 on Emacs 20.3 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <19990713232801E.okuji@kuicr.kyoto-u.ac.jp>
Date: Tue, 13 Jul 1999 23:28:01 +0900
X-Dispatcher: imput version 980905(IM100)
Lines: 35

  Hello,

  I found a bug in GNU Assembler (binutils-2.9.1.0.25,
i586-linux-gnu). My code is actually more complex, but I can reproduce
the bug by assembling this:

	.file "check.s"
	.text
foo:
	jmp	bar
	. = foo + 4
	.byte	0
	.byte	0
	. = foo
poo:
	.byte 0
bar:
	cli


% as check.s -o check
check.s: Assembler messages:
check.s:12: Error: attempt to .org backwards ignored
check.s:12: Error: attempt to .org backwards ignored
check.s:12: Error: attempt to .org/.space backwards? (-2)
check.s:12: Internal error!
Assertion failure in write_contents at write.c line 1106.
Please report this bug.


Regards,
OKUJI
----------------------------------------------------------------------
OKUJI Yoshinori  <okuji@kuicr.kyoto-u.ac.jp>           ^o-o^
http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English)     m /


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: a bug in as
  1999-07-13 11:28 a bug in as H.J. Lu
@ 1999-07-14 17:04 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 1999-07-14 17:04 UTC (permalink / raw)
  To: hjl; +Cc: binutils

   Date: Tue, 13 Jul 1999 11:28:34 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   I got this report. The code is wrong. But as message doesn't help
   either. Is there a way for as to report correct line number? Also
   it shouldn't be an internal error.

I checked in the appended patch.

Ian

Index: write.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/write.c,v
retrieving revision 1.7
diff -u -r1.7 write.c
--- write.c	1999/07/11 20:20:01	1.7
+++ write.c	1999/07/14 20:55:33
@@ -498,8 +498,9 @@
 			  - fragP->fr_fix) / fragP->fr_var;
       if (fragP->fr_offset < 0)
 	{
-	  as_bad (_("attempt to .org/.space backwards? (%ld)"),
-		  (long) fragP->fr_offset);
+	  as_bad_where (fragP->fr_file, fragP->fr_line,
+			_("attempt to .org/.space backwards? (%ld)"),
+			(long) fragP->fr_offset);
 	}
       fragP->fr_type = rs_fill;
       break;
@@ -2302,8 +2303,16 @@
 		      /* Growth may be negative, but variable part of frag
 			 cannot have fewer than 0 chars.  That is, we can't
 			 .org backwards. */
-		      as_bad (_("attempt to .org backwards ignored"));
-		      growth = 0;
+		      as_bad_where (fragP->fr_file, fragP->fr_line,
+				    _("attempt to .org backwards ignored"));
+
+		      /* We've issued an error message.  Change the
+                         frag to avoid cascading errors.  */
+		      fragP->fr_type = rs_align;
+		      fragP->fr_subtype = 0;
+		      fragP->fr_offset = 0;
+		      fragP->fr_fix = after - address;
+		      growth = stretch;
 		    }
 
 		  growth -= stretch;	/* This is an absolute growth factor */

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-07-14 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-13 11:28 a bug in as H.J. Lu
1999-07-14 17:04 ` Ian Lance Taylor

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).