Second Printing Errata

In the lists below, line +n and line -n refer to the nth line from the top and bottom of the indicated page.

Page 342, lines +12..15: this code should read

defglobal(cp->u.swtch.table, LIT);
(*IR->defaddress)(equated(cp->u.swtch.labels[0]));
for (i = 1; i < cp->u.swtch.size; i++) {
	long k = cp->u.swtch.values[i-1];
	while (++k < cp->u.swtch.values[i])

The errors below also appear in the first printing.

Page 8, line -22: Change `ADDRGP' to `ADDRFP'.

Page 15, line +7: In Table 1.1, `ops.h' should be `c.h'.

Page 18, line +1: `va_dcl;' should be `va_dcl'.

Page 24, line +12: Change `disasterous' to `disastrous'.

Page 24, line -12: Change `incidently' to `incidentally'.

Page 26, line -8: To avoid invalid pointers, the condition should read `n > ap->limit - ap->avail'.

Page 28, line +3: Change `10*1024' to `roundup(10*1024, sizeof (union align))'.

Page 31, line +20: To avoid invalid pointers, the condition should read `len + 1 >= strlimit - next'.

Page 52, line +5: `tables' should be `symbols'.

Page 56, line +11: `40 4' should be `4 40'.

Page 56, line -17: Change `can' to `can be'.

Page 57, line +3: Change `NEW' to `NEW0'.

Page 57, line +9: Delete.

Page 64, lines -6..-3: Change these lines to

Internally, the prototype for functions with no arguments is empty;
it consists of only the terminating null. Thus, the type of f
is depicted as
(FUNCTION (VOID) {})

Page 65, line +1: The correct prototype for sprintf is

int sprintf(char *, const char *, ...)

Page 65, line +8: `(CHAR)' should read `(CONST (CHAR))'.

Page 65, line -15: Change `one or more' to `zero or more'.

Page 65, lines -13..-12: Change `one-element prototype {(VOID)}' to `zero-length prototype {}'.

Page 71, line +22: Change to

if (promote(ty) != (isenum(ty) ? ty->type : ty)
|| ty == floattype)

Page 74, line -9: Change `the bit strings' to `bit strings'.

Page 82, line +5: Change `exceed' to `exceeds'.

Page 83, lines +13..14: Should read `ADDP, in which an integer operand in kids[1] is added to a pointer operand in kids[0],'

Page 97, lines +5..6: Change `Exercises 5.2 and 5.1' to 'Exercises 5.1 and 5.2'.

Page 106, lines +9..16: Change to

	} else {
		lineno++;
		for (line = (char *)cp; *cp==' ' || *cp=='\t'; cp++)
			;
		if (*cp == '#') {
			resynch();
			nextline();
		}
	}
} while (*cp == '\n' && cp == limit);

Page 113, line +5: Change `28' to `32'.

Page 113, line +8: Add the line

case        enum      register  typedef

Page 118, lines +6 and +11: Change `LONG_MAX' to `~(1<<8*longtype->size - 1)'.

Page 118, line +13: Change `INT_MAX' to `~(1<<8*inttype->size - 1)'.

Page 118, line +20: Change to

n = ~(1<<8*longtype->size - 1);
tval.type = longtype;

Page 124, line +21: `&cbuf[sizeof cbuf] - 2' should read `&cbuf[sizeof cbuf] - 1'.

Page 134, line +10: `return 1' should read `return 0'.

Pages 155-182: Occurrences of <tree.c data>, <tree.c exported macros>, and <tree.c functions> should be changed to <expr.c data>, <expr.c exported macros>, and <expr.c functions>.

Page 173, line -1: `(POINTER T) decay into (FUNCTION T)' should read `(FUNCTION T) decay into (POINTER T)'.

Page 181, line -7: `which is has' should be `which has'.

Page 186, line +23: Change to

ty = func(voidtype, NULL, 1);
p = retype(p, ptr(ty));

Page 227, line -4: `expression != 0' should be `expression == 0'.

Page 229, lines +13, -1: `defpoint' should be `definept'.

Page 256, line -1: Change to

ty = tsym->type;
if (isqual(ty)
&& ty->size != ty->type->size) {
	ty = unqual(ty);
	if (isconst(tsym->type))
		ty = qual(CONST, ty);
	if (isvolatile(tsym->type))
		ty = qual(VOLATILE, ty);
	tsym->type = ty;
}

Page 289, lines +17..18: Change to

{
	Type ty = unqual(proto[i]);
	if (eqtype(isenum(ty) ? ty->type : ty,
		unqual(caller[i]->type), 1) == 0)
		break;
}

Page 320, lines -4, -18: `32 - m' to `32 - m - s' (the definition of fieldleft on p. 66 is correct).

Page 345, line -14: `*t2' should be `t2'. 

Page 349, line +19: Change `similer' to `similar'.

Page 354, line +8: Change `emit' to `emitcode'.

Page 373, lines -4, -7, -8: Change `ADDI' to `ADDP'.

Page 374, Figure 14.1: Change `ADDP(addr,con)' to `ADDP(reg,con)'.

Page 375, line -19: Change `BURM.' to `BURM'.

Page 380, line +10: Change `5' to `4'.

Page 383, lines -6..-7: Change `value of i' to `value of q->b' and `x[0]' to `p->b'.

Page 398, line +10: `preload' should be `prelabel'.

Page 411, line +1: Change `askfixedregr' to `askfixedreg'.

Page 411, line -3: Change `askregvar' to `askreg'.

Page 445, line +7: Change `placement' to `placement of'.

Page 451, line -7: Change `4' to `usedmask[FREG] ? 8 : 4'.

Page 488, line +10: Change to

print(".align 4\n%s:\n", f->x.name);

Page 489, lines -10: Change to

{ <spill floats and doubles from i0-i5 489> }

Page 493, lines -6, -4 and
Page 494, lines +14, +15: Change occurrences of `tmp' to `tmps'.

Page 502, lines -18, -15: Change occurrences of `nstate' to `nstack'.

Thanks to Nelson Beebe, Franklin Chen, Ming Chen, Amnon Cohen, Russ Cox, Marcin Ciura, Guy Laden, Jonathan Litt, Paul Mattal, Scott Nicholas, Richard O'Keefe, Norman Ramsey, Sukyoung Ryu, Duane Sand, Bernie Solomon, Reuben Thomas, Gary Tyson, and Lei Zhou for finding some of these errors.


Chris Fraser · David Hanson