[comp.sys.amiga] vt100 version 2.7 and Lattice 3.03

stever@videovax.Tek.COM (Steven E. Rice, P.E.) (11/21/87)

A year or so ago, a sometime bug in an early version of vt100 was
traced to improper code generated by the Lattice 3.03 compiler when
it encountered a construct of the form:

           FooBaz[n+1] = something;

This was fixed by the simple expedient of creating a new variable,
nplus1, and doing the following (if you don't believe me, grep init.c
for "nplus1"!).

           nplus1 = n + 1;
           FooBaz[nplus1] = something;

An expression with a potential for causing this problem cropped up in
vt100, version 2.7, in expand.c.  A diff file to circumvent the problem
(for those who, like me, are stuck with Lattice 3.03) follows:


*** Original/expand.c	Mon Oct  5 17:13:37 1987
--- expand.c	Fri Nov 20 22:30:10 1987
***************
*** 293,298
  {
     register 	char 		*s;
     int   			i;
     struct 	FileLock 	*lock;
     char 			temp[60];
     struct       FileInfoBlock   *fib;

--- 293,299 -----
  {
     register 	char 		*s;
     int   			i;
+    int   			iplus1;
     struct 	FileLock 	*lock;
     char 			temp[60];
     struct       FileInfoBlock   *fib;
***************
*** 305,311
  	 for (i=strlen(MyDir);
  	      MyDir[i] != '/' && MyDir[i] != ':';
  	      i--);
! 	 MyDir[i+1] = '\0';
  	 strcat(MyDir, s);
  	 }
        else if (exists(s, ':') == 0) {

--- 306,313 -----
  	 for (i=strlen(MyDir);
  	      MyDir[i] != '/' && MyDir[i] != ':';
  	      i--);
! 	 iplus1 = i + 1;
! 	 MyDir[iplus1] = '\0';
  	 strcat(MyDir, s);
  	 }
        else if (exists(s, ':') == 0) {


					Steve Rice

-----------------------------------------------------------------------------
new: stever@videovax.tv.Tek.com
old: {decvax | hplabs | ihnp4 | uw-beaver}!tektronix!videovax!stever

walker@sas.UUCP (Doug Walker) (11/24/87)

In article <4691@videovax.Tek.COM>, stever@videovax.Tek.COM (Steven E. Rice, P.E.) writes:
> (for those who, like me, are stuck with Lattice 3.03) 
Why are you still stuck with Lattice 3.03?  Lattice's upgrade policy is very 
liberal, and the newly-released Lattice 4.0 is light-years ahead of 3.03.  
Even Lattice 3.10 is at least one light-year ahead.  Go ahead, spend the $40 on
the upgrade! 

From personal experience, my 3.10 Lattice programs shrink between 10% and 15% 
with NO CODE CHANGES WHATSOEVER under 4.0, and 3.10 produces much smaller 
executables that 3.03 did!


DISCLAIMER:  I work for SAS Institute Inc, which owns Lattice, Inc, but I 
have no professional connection with Lattice.  The opinions represented here
were my own the last time I checked.

acs@amdahl.amdahl.com (Tony Sumrall) (11/25/87)

In article <4691@videovax.Tek.COM> stever@videovax.Tek.COM (Steven E. Rice, P.E.) writes:
>A year or so ago, a sometime bug in an early version of vt100 was
>traced to improper code generated by the Lattice 3.03 compiler when
>it encountered a construct of the form:
>
>           FooBaz[n+1] = something;
>
>This was fixed by the simple expedient of creating a new variable,
>nplus1, and doing the following (if you don't believe me, grep init.c
>for "nplus1"!).

Fixed in 2.8!
-- 
Tony Sumrall acs@amdahl.com <=> amdahl!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]