Article View: gnu.gcc.bug
Article #689gcc bug
From: henry Balen
Date: Wed, 04 Oct 1989 15:24
Date: Wed, 04 Oct 1989 15:24
35 lines
1032 bytes
1032 bytes
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);
}
Technical Details
Message-ID:
<3944.8910041524@apollo.camscan.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!tut.cis.ohio-state.edu!nsfnet-relay.ac.uk!balen%camscan.uucpShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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