drazen@VLSI.CALTECH.EDU (Drazen Borkovic) (03/31/89)
Gcc 1.34 does not reuse space on stack that was used by variable local to the block that has ended. Variables k and kk in the bl.c could exist in the same place on stack, but gcc allocates separate words for each of them. Although not wrong, this is wasteful. Sun cc reuses that space. ====================================================================== Script started on Thu Mar 30 14:24:52 1989 !21 mars:c -> cat bl.c void f (j) int j; { int i; { int k; i = k+j; } { int kk; i = kk+j; } } !22 mars:c -> gcc -ansi -pedantic -Wall -Wwrite-strings -v -S bl.c gcc version 1.34 /usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -T -$ -D__STRICT_ANSI__ -D__mc68000__ -D__sun__ -D__unix__ -pedantic -Wall -D__HAVE_68881__ bl.c /tmp/cca26952.cpp GNU CPP version 1.34 /usr/local/lib/gcc-cc1 /tmp/cca26952.cpp -quiet -dumpbase bl.c -Wall -Wwrite-strings -pedantic -ansi -version -o bl.s GNU C version 1.34 (68k, MIT syntax) compiled by GNU C version 1.34. !23 mars:c -> cat bl.s #NO_APP gcc_compiled.: .text .even .globl _f _f: link a6,#-12 movel a6@(-8),d0 # int k addl a6@(8),d0 movel d0,a6@(-4) movel a6@(-12),d0 # int kk addl a6@(8),d0 movel d0,a6@(-4) L1: unlk a6 rts !24 mars:c -> exit script done on Thu Mar 30 14:25:34 1989 ====================================================================== Drazen Borkovic, Caltech 256-80, Pasadena, CA 91125 e-mail: drazen@vlsi.caltech.edu