🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd
Article #1208

Portable C Compiler Bug

#1208
From: Anne M. Holler
Date: Fri, 07 Oct 1988 14:30
38 lines
1892 bytes
    I have found and fixed a bug in the version of the Portable C compiler
distributed with Berkeley UNIX 4.3.  The bug causes the compiler to some-
times fail giving the error message "schain botch".
    The situation is that in the process of clearing the symbol table at
the end of a block (in the function clearst in the module pftn.c), the
compiler moves into the newly-freed symbol table entries any remaining
entries previously blocked by the removed symbols from hashing into those
positions.  However, pointers to symbol table entries are kept in a linked
list for the block level to which they belong (schain), and these pointers
are not being updated to reflect the moved entries' new locations.
    The bug fix is as follows.  When an entry in the symbol table is moved
into a freed position, its pointer in the schain is found and modified.  A
portion of code from clearst along with the changes necessary is given below.
Existing code:
			if( (r = relook(q)) != q ) {
				*r = *q;
				q->stype = TNULL;
				}
Revised code:
			if( (r = relook(q)) != q ) {
			    struct symtab *sptr, *sptrbak;
				*r = *q;
				/* Fix up mishashed entries' schain values */
				for (sptrbak=sptr=schain[q->slevel]; sptr!=NULL;
				     sptrbak=sptr,sptr=sptr->snext) {
					if (sptr==q) {
						if (sptr == sptrbak)
							schain[q->slevel] = r;
						else
							sptrbak->snext = r;
						break;
						}
					}
				q->stype = TNULL;
				}
    Please feel free to correspond with me about this matter.  Thanks.
Anne Holler
Technical Details
Message-ID: <2737@uvacs.cs.Virginia.EDU>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!uflorida!haven!uvaarpa!virginia!uvacs!amh

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!uflorida!haven!uvaarpa!virginia!uvacs!amh
From: amh@uvacs.cs.Virginia.EDU (Anne M. Holler)
Newsgroups: comp.bugs.4bsd
Subject: Portable C Compiler Bug
Message-ID: <2737@uvacs.cs.Virginia.EDU>
Date: 7 Oct 88 14:30:04 GMT
Organization: U.Va. CS Department, Charlottesville, VA
Lines: 38