From: utzoo!decvax!cca!gwyn@utexas-11@sri-unix Newsgroups: net.unix-wizards Title: System III Ritchie C compiler bug Article-I.D.: sri-unix.1571 Posted: Fri May 28 13:20:26 1982 Received: Sat May 29 07:07:32 1982 From: Douglas A GwynDate: 2 May 1982 at 2315-CDT The new C optimizer allocates string storage off the stack for the first 5000 characters, then overflows to the heap as before. Unfortunately, the allocator can wrap around the address space (this happened three times during compilation of the compiler, for example). In module c21.c, change line 386 from if (alasta+n < alastr) { to if (alasta+n < alastr && alasta+n > alasta) { in order to catch the wrap-around. Note also that line 182 of c21.c r = -1; is superfluous. While fixing the bug, you might want to install the following change in module c11.c starting at line 862, in order to permit auto floats to work correctly (since otherwise access causing stack growth will abort a floating-point operation -- an FP11/KT11 design botch): switch ( t = geti() - 6 ) { case 4: /* NOT "cmp -(sp),-(sp)" */ printf( "tst -(sp)\n" ); case 2: printf( "tst -(sp)\n" ); case 0: break; default: printf( "sub $%o,sp\n", t ); /* pre-extend stack to avoid KT11 problem */ printf( "tst (sp)\n" ); } break; This fix may not be necessary on all PDP-11s but is needed for an 11/34. -------