Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!quick.com!srg From: srg@quick.com (Spencer Garrett) Newsgroups: gnu.gcc.bug Subject: alloca provokes optimizer bug Message-ID: <8912121006.AA18083@quick.com> Date: 12 Dec 89 10:06:38 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 35 gcc 1.36 on Sun 3/50 flags -S -O unoptimized code appears to be correct. the optimized code gets b and c confused when generating the call to sub2(). sub(n) int n; { char a[3]; char b[n + 3]; char c; sub2(a, b, c); } #NO_APP gcc_compiled.: .text .even .globl _sub _sub: link a6,#-4 movel a6@(8),d0 addql #4,d0 moveq #-2,d1 andl d1,d0 subl d0,sp movel sp,d0 | "alloca" results are correct extbl d0 | forgot to load c movel d0,sp@- movel d0,sp@- | clobbered address of b pea a6@(-4) jbsr _sub2 unlk a6 rts