🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #295

gas-1.34(ns32k) displacements are sometimes wrong

#295
From: John F. Peters
Date: Wed, 12 Jul 1989 18:50
113 lines
2784 bytes
DESCRIPTION:
   gas-1.34(ns32k) sometimes produces a displacement that is 
   slightly too large, and misses its target by a few bytes.

REPEAT-BY:
   Assemble this program, and examine the output file.
   Three displacement fields will be in error.
------------------------------------------------------------------------------
	.globl	_gets
_gets:
	enter	[r6,r7],0
	movd	12(fp),r7	
L93:
	cxp	_getchar	|ERROR: disp is 0xfffffffe should be 0xfffffffc
	movd	r0,r6	
	andd	127,r6	
L94:
	movd	r6,r0	
	br	L96
L97:
L98:
	addr	@10,r6	
	movqb	0,0(r7)	
	addqd	1,r7	
	br	L90
L99:
L100:
	addqd	-1,r7	
	cmpd	r7,12(fp)	
	bge	L101
	movd	12(fp),r7	
L101:
	br	L91		|ERROR: disp is L91+3
L102:
L103:
	movd	12(fp),r7	
	addr	@10,tos	
	cxp	_putchar	
	adjspb	-4
	br	L91
L104:
	movb	r6,0(r7)	
	addqd	1,r7	
	br	L95
L96:
	cmpd	8,r0
	beq	L99
	cmpd	10,r0
	beq	L97
	cmpd	13,r0
	beq	L98
	cmpd	21,r0
	beq	L103
	cmpd	35,r0
	beq	L100
	cmpd	64,r0
	beq	L102
	br	L104
L95:
L91:
	br	L93		|ERROR: disp is L93+3
L92:
L90:
	exit	[r6,r7]
	rxp	0
------------------------------------------------------------------------------

FIX:
   There is a brace error near the end of convert_iif(ns32k.c),
   that effectively accrues the size of *all* the iif entries
   into size_so_far, including the dead (i.e. type==0) ones.
   Every now and then, a dead entry will have a non-zero size
   left from a previous instruction, and this gets added to
   size_so_far.  The overlarge size_so_far is assigned to a
   fragment's fr_pcrel_adjust field, and later, md_convert_frag
   (ns32k.c) dutifully adds this bogus value to an otherwise-
   correct displacement.

------------------------------------------------------------------------------
*** ns32k.c.00	Fri May 26 19:35:55 1989
--- ns32k.c	Fri Jun 30 18:12:52 1989
***************
*** 1194,1197
  	  as_fatal("Internal logic error in iif.iifP[].type");
  	}
        }
        size_so_far+=size;

--- 1194,1199 -----
  	  as_fatal("Internal logic error in iif.iifP[].type");
  	}
+         size_so_far+=size;
+         size=0;
        }
      }
***************
*** 1195,1200
  	}
        }
-       size_so_far+=size;
-       size=0;
      }
  }

--- 1197,1200 -----
          size=0;
        }
      }
  }


-- 
jfp@practic.com   {uunet,sun,pyramid}!practic!jfp   408 749 8900
Technical Details
Message-ID: <41134@practic.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!voder!pyramid!leadsv!practic!jfp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!voder!pyramid!leadsv!practic!jfp
From: jfp@practic.UUCP (John F. Peters)
Newsgroups: gnu.utils.bug
Subject: gas-1.34(ns32k) displacements are sometimes wrong
Message-ID: <41134@practic.UUCP>
Date: 12 Jul 89 18:50:22 GMT
Reply-To: jfp@practic.UUCP (John F. Peters)
Organization: Practical Computing Inc., Sunnyvale
Lines: 113