Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!tut.cis.ohio-state.edu!nsfnet-relay.ac.uk!balen%camscan.uucp From: balen%camscan.uucp@nsfnet-relay.ac.uk (henry Balen) Newsgroups: gnu.gcc.bug Subject: gcc bug Message-ID: <3944.8910041524@apollo.camscan.co.uk> Date: 4 Oct 89 15:24:53 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 35 There appears to be a bug in the gcc version 1.35 running on the Sun386i. I compiled the source that is listed below with gcc -o add add.c And when I run add it causes a segmentation violation! As you can see the program is fairly small. /* * */ main() { int *x,*b,*c; register int i; x = (int*)malloc(sizeof(int)*10); b = (int*)malloc(sizeof(int)*10); c = (int*)malloc(sizeof(int)*10); for ( i = 0; i < 10; i++ ) x[i] = c[i] + b[i]; /* the following works instead! * for (i = 0; i < 10; i++) { * x[i] = c[i]; * x[i] += b[i]; * } */ free(x); free(b); free(c); }