A fix for a bug in the previously distributed f77 fixes (sigh)

donn at sdchema.UUCP donn at sdchema.UUCP
Wed Apr 18 05:14:44 AEST 1984


I realized shortly after sending it out that the previous big set of
fixes that implemented Bob Corbett's mkargtemp() function had a bug.
The bug crops up when you use CHARACTER or COMPLEX valued functions --
the compiler breaks down and complains about 'bad type 0 in putaddr' or
something.  What has happened is that one of mkargtemp's private
temporaries was accidentally given away to another routine, which freed
it, causing it to get stomped on.  The following set of fixes (sigh)
elminates this problem (it actually fixes a set of problems, and
replaces an earlier bug fix of mine in Bob Corbett's code).

The first step is to make sure that mkargtemp() in proc.c never gives
away an actual temporary, only a copy of one:

------------------------------------------------------------------------
*** /tmp/,RCSt1005360	Tue Apr 17 13:45:05 1984
--- proc.c	Mon Apr 16 12:05:50 1984
***************
*** 1065,1071
  	  p->nextp = activearglist;
  	  activearglist = p;
  
! 	  return (q);
  	}
  
        oldp = p;

--- 1070,1076 -----
  	  p->nextp = activearglist;
  	  activearglist = p;
  
! 	  return ((Addrp) cpexpr(q));
  	}
  
        oldp = p;
***************
*** 1074,1080
  
    q = autovar(1, type, lengp);
    activearglist = mkchain(q, activearglist);
!   return (q);
  }
  ^L
  /* VARIOUS ROUTINES FOR PROCESSING DECLARATIONS */

--- 1079,1085 -----
  
    q = autovar(1, type, lengp);
    activearglist = mkchain(q, activearglist);
!   return ((Addrp) cpexpr(q));
  }
  ^L
  /* VARIOUS ROUTINES FOR PROCESSING DECLARATIONS */
------------------------------------------------------------------------

The other change is to remove the remains of the old fix in putcall()
in putpcc.c:

------------------------------------------------------------------------
*** /tmp/,RCSt1005497	Tue Apr 17 13:58:59 1984
--- putpcc.c	Mon Apr 16 10:44:46 1984
***************
*** 1392,1398
  			t = mkargtemp(qtype = q->headblock.vtype,
  				q->headblock.vleng);
  			putassign( cpexpr(t), q );
! 			putaddr( cpexpr(t), NO );
  			putcomma(1, qtype, YES);
  			}
  		}

--- 1396,1402 -----
  			t = mkargtemp(qtype = q->headblock.vtype,
  				q->headblock.vleng);
  			putassign( cpexpr(t), q );
! 			putaddr(t, NO);
  			putcomma(1, qtype, YES);
  			}
  		}
------------------------------------------------------------------------

Sorry about this...

Donn Seeley    UCSD Chemistry Dept.       ucbvax!sdcsvax!sdchema!donn



More information about the Comp.bugs.4bsd.ucb-fixes mailing list