Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!mit-eddie!apollo!vasta From: vasta@apollo.HP.COM (John Vasta) Newsgroups: comp.sys.apollo Subject: Re: GCC bug? Message-ID: <4cc0203b.20b6d@apollo.HP.COM> Date: 11 Sep 90 20:32:00 GMT References: <1990Sep10.151351.20186@water.waterloo.edu> <1990Sep11.125319.21412@ncsuvx.ncsu.edu> Sender: root@apollo.HP.COM Reply-To: vasta@apollo.HP.COM (John Vasta) Followup-To: comp.sys.apollo Organization: Hewlett-Packard Company, Apollo Division; Chelmsford, MA Lines: 30 In article <1990Sep11.125319.21412@ncsuvx.ncsu.edu> jwb@cepmax.ncsu.edu writes: >I'm using gcc version 1.37.1 (with John Vasta's patches) to compile >the following program on a DN4500 (SR10.2, BSD4.3): > > 1 main() > 2 { > 3 char x[10]; > 4 long i; > 5 > 6 for (i = 0; i <= 10; i++) x[i] = 'a'; > 7 > 8 return 0; > 9 } > >Upon executing the program I get: > >% a.out >unable to unwind stack because of invalid stack frame (process >manager/process fault manager) > >However, if I swap lines 3 and 4 it runs perfectly. Any ideas? A classic pitfall - you're writing beyond the end of the array. Legal index values for a 10-element array range from 0 to 9, but you're writing to x[10]. John Vasta Hewlett-Packard Apollo Systems Division vasta@apollo.hp.com M.S. CHR-03-DW (508) 256-6600 x5978 300 Apollo Drive, Chelmsford, MA 01824 UUCP: {decwrl!decvax, mit-eddie, attunix}!apollo!vasta