Hi,
I thought I'd found a gcc compiler error (and still may have). The
following program crashes with a segmentation fault.
#define N 209677
int main(int argv, char **argc) {
int
i;
double
a[N],
b[N],
c[N],
d[N],
e[N];
c[0]=0.0;
i=1;
c[i]=c[i-1];
}
If I make N slightly less, or reduce the number of arrays defined, it
runs fine. If I write instead "c[1]=c[0]" it runs fine. Basically, I
simplified the original program as much as I could in ways which still
caused the Seg Fault to happen.
So I thought this must be a compiler error. The program was called
"thick4.c". I used emacs to paste the file into a new buffer called
"test.c". But this one worked fine when I compiled!!!! The two files
"thick4.c" and "test.c" are identical, as both diff and cmp prove.
The executables "thick4" and "test" differ very slightly however.
-rwxrwxr-x 1 mark mark 4731 Mar 7 02:53 test*
-rw-rw-r-- 1 mark mark 162 Mar 7 02:53 test.c
-rwxrwxr-x 1 mark mark 4733 Mar 7 02:53 thick4*
-rw-r--r-- 1 mark mark 162 Mar 7 02:51 thick4.c
and
$ cmp thick4 test
thick4 test differ: char 3061, line 2
Why would identical files compile to slightly different executables?
I have included gzipped versions of these executables with this email.
Has anyone got any idea what might be going on? Or suggestions about
what I could investigate next!
Also, can anyone else replicate the error I got (using thick4.c as
your file name).
Thanks,
Mark.
--
_/~~~~~~~~\___/~~~~~~\____________________________________________________
____/~~\_____/~~\__/~~\__________________________Mark_Phillips____________
____/~~\_____/~~\________________________________mark@ist.flinders.edu.au_
____/~~\HE___/~~\__/~~\APTAIN_____________________________________________
____/~~\______/~~~~~~\____________________________________________________
__________________________________________________________________________
"They told me I was gullible ... and I believed them!"
Attachment:
thick4.gz
Description: Binary data
?í¥: test åX[lTE?³{
´?ÛÃF%?Dm?Z?^?Ú¤\¤+Á@<lwO»kv÷lvÏêâ%¶H©éC?SLÔhÄl¢?>TJDã%Äh0* &????D?!®ß?3gÏìº$¾øä4³3ßüß?ÿÌæ?Kû¶i?ÆÜäc~FèÒ½¶
å[óE{°y¬?e«PFyuÊ5È:²ù:eÈ(/C}??i2óåP&}V/ä¼m2äeó¤Ü?b
ò)È(?>)åºÌµè¤ö°^K9 Pdñ?
?è½?x*?7²¶Ñ*ÚëåØzv<.}á%¿ì¿FÖuE¦Up+S?ò)øó?w ¯Fþøm?;?¿