gnu@sun.uucp (John Gilmore) (12/04/84)
> I have recently had some practical experience with this issue. On the > Gould UTX-32 system (and I believe on IBM 370s too), the architecture > rather strongly encouraged the C/UNIX implementors to use a relatively > small chunk of address space for the run-time stack... > ...I imagine someone has written code that needs more, but > they have already severely limited their target machine choices. The Sun C compiler used to have this restriction. We fixed it. It was easy (on the 68000). Hey, all you people who "severely limited their target machine choices" -- your code will run fine on Suns! It's hard to believe a serious IBM mainframe Unix port would limit stack size to 64K out of a 16MB (larger on newer models) linear address space. Especially since "stacks" on a 370 are a software abstraction -- there is no hardware support for them.
mp@allegra.UUCP (Mark Plotnick) (12/11/84)
> From gnu@sun.uucp (John Gilmore) > The Sun C compiler used to have this restriction. We fixed it. It was easy > (on the 68000). Hey, all you people who "severely limited their target > machine choices" -- your code will run fine on Suns! Note that if you care about getting correct code out of the SMI C compiler, you shouldn't use stack frames larger than 32Kbytes. This is because of a bug in their compiler (at least as of release 1.1, which is what we have) with the handling of floating point operations that require scratch areas on the stack. The compiler doesn't seem to know that displacements, as in reg@(disp), are limited to 16-bit signed integers. Example: calliope% cat bug.c #ifndef SIZE #define SIZE 30000 #endif #include <stdio.h> main() { char HIGHBOUND; double tx,temp; char c[SIZE]; int lcv, i; char LOWBOUND; printf("&LOWBOUND=%d &HIGHBOUND=%d\n", &LOWBOUND, &HIGHBOUND); printf("stack size = approx %d\n", &HIGHBOUND - &LOWBOUND); fflush(stdout); for(i=0;i<SIZE;i++) c[i]=0; tx = 1.0; lcv = 1; temp = tx/lcv; for(i=0;i<SIZE;i++) if(c[i]) printf("oops, c[%d]=%d\n",i,0377&c[i]); } calliope% cc bug.c -O -o bug -DSIZE=30000 calliope% bug &LOWBOUND=16746693 &HIGHBOUND=16776719 stack size = approx 30026 calliope% cc bug.c -O -o bug -DSIZE=50000 calliope% bug &LOWBOUND=16726693 &HIGHBOUND=16776719 stack size = approx 50026 Segmentation fault (core dumped) calliope% cc bug.c -O -o bug -DSIZE=70000 calliope% bug &LOWBOUND=16706693 &HIGHBOUND=16776719 stack size = approx 70026 oops, c[65518]=63 oops, c[65519]=240 In the last program, the offending instructions in bug.s are (just after the jbsr fvflti): movl d0,a6@(-70036) movl d1,a6@(-70032) Mark Plotnick Department of Sun burns allegra!mp