public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* Re: An old gas bug
       [not found] <199408171947.PAA12811@sanguine.cygnus.com>
@ 1994-08-17 14:36 ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 1994-08-17 14:36 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gas2

> gas isn't my responsibility, but I think this fix is wrong.  It
> appears to assume that the field holds a signed value.  You can't make
> that assumption in the machine independent file write.c.  Suppose the
> field were intended to hold an unsigned value, and the user tried to
> put 0x80 in it?
> 

That is true. But, at least my patch won't generate bogus code :-(.

> I think this sort of thing needs to be checked in md_apply_fix.
> 
> Ian
> 


-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com


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

* Re: An old gas bug
  1994-08-17  6:08 ` Michael Meissner
@ 1994-08-17  6:16   ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 1994-08-17  6:16 UTC (permalink / raw)
  To: Michael Meissner; +Cc: gas2

> 
> | Hi,
> | 
> | This is a very old bug date back to 1.38.1. The reason no one really
> | cares is gcc won't generate that kind of code, i.e., jump out of range.
> | When some Linux people were working on X11R5, they used an Intel x86
> | branch/loop instruction, jcxz, which has only byte displacements in
> | the hand coded asm code. The AT&T as worked fine with expansion. But
> | gas 1.38.1 generated some bogus codes. I fixed the bug for them. I
> | think it is correct. The test case is very easy to produce. Please let
> | me know if you need one.
> 
> While it should be certainly fixed in the assembler, the X11 code
> should also replace the jcxz instruction with a compare against 0 and
> jmp sequence, since that is faster on anything but an original 386.
> See the optimization guides in the 486/pentium manuals.
> 
> 

After I told them that, they have then changed the code.

-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com


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

* An old gas bug
  1994-08-16 16:04 H.J. Lu
@ 1994-08-17  6:08 ` Michael Meissner
  1994-08-17  6:16   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Meissner @ 1994-08-17  6:08 UTC (permalink / raw)
  To: hjl; +Cc: gas2

| Hi,
| 
| This is a very old bug date back to 1.38.1. The reason no one really
| cares is gcc won't generate that kind of code, i.e., jump out of range.
| When some Linux people were working on X11R5, they used an Intel x86
| branch/loop instruction, jcxz, which has only byte displacements in
| the hand coded asm code. The AT&T as worked fine with expansion. But
| gas 1.38.1 generated some bogus codes. I fixed the bug for them. I
| think it is correct. The test case is very easy to produce. Please let
| me know if you need one.

While it should be certainly fixed in the assembler, the X11 code
should also replace the jcxz instruction with a compare against 0 and
jmp sequence, since that is faster on anything but an original 386.
See the optimization guides in the 486/pentium manuals.



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

* An old gas bug
@ 1994-08-16 16:04 H.J. Lu
  1994-08-17  6:08 ` Michael Meissner
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1994-08-16 16:04 UTC (permalink / raw)
  To: gas2

Hi,

This is a very old bug date back to 1.38.1. The reason no one really
cares is gcc won't generate that kind of code, i.e., jump out of range.
When some Linux people were working on X11R5, they used an Intel x86
branch/loop instruction, jcxz, which has only byte displacements in
the hand coded asm code. The AT&T as worked fine with expansion. But
gas 1.38.1 generated some bogus codes. I fixed the bug for them. I
think it is correct. The test case is very easy to produce. Please let
me know if you need one.

-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com
----
Tue Aug 16 18:48:10 1994  H.J. Lu (hlu@nynexst.com)

	* write.c (fixup_segment): fix the displacement range
	  checking. "add_number" may be signed and is of type int.
	  We only shift by size * 8 - 1.

*** gas/write.c	Thu Jul 14 14:57:47 1994
--- gas/write.c.new	Tue Aug 16 18:47:11 1994
***************
*** 2195,2202 ****
  		 half-way operations should both be defined.  And the
  		 compiler should be able to combine them if it's valid on
  		 the host architecture.  */
! 	      mask <<= size * 4;
! 	      mask <<= size * 4;
  	      if ((add_number & mask) != 0
  		  && (add_number & mask) != mask)
  		{
--- 2195,2201 ----
  		 half-way operations should both be defined.  And the
  		 compiler should be able to combine them if it's valid on
  		 the host architecture.  */
! 	      mask <<= size * 8 - 1;
  	      if ((add_number & mask) != 0
  		  && (add_number & mask) != mask)
  		{


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

end of thread, other threads:[~1994-08-17 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199408171947.PAA12811@sanguine.cygnus.com>
1994-08-17 14:36 ` An old gas bug H.J. Lu
1994-08-16 16:04 H.J. Lu
1994-08-17  6:08 ` Michael Meissner
1994-08-17  6:16   ` H.J. Lu

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