[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <16383.27368.283250.733079@mail.linux-delhi.org>
From: raju at linux-delhi.org (Raj Mathur)
Subject: gcc: Internal compiler error: program cc1 got fatal signal 11
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>> "Dale" == Dale Harris <rodmur@...be.org> writes:
Dale> On Sat, Jan 10, 2004 at 12:41:20AM +0100, m.esco@...pl
Dale> elucidated:
>> No Segmentation Fault on Slackware 9.1, Kernel 2.4.24, GCC
>> 3.2.3.
>>
>>
>> > Confimed - Segmentation Fault
>> >
>> > OS = Slackware 9.1.0 > Kernel = 2.4.22 > GCC = 3.2.3
>> >
>> > int main(void) > { > printf("%c","msux"[0xcafebabe]); > } > $
>> gcc gcc-crash.c > $ ./a.out > Segmentation fault
Dale> Well, honestly... is this interesting if seg. faults when
Dale> you execute it? Or am I just missing something? You're
Dale> accessing an array that hasn't been defined, that is a big
Dale> "DUH!" in my book. It is interesting if it kills the
Dale> compiler while trying to compile it, when it should be
Dale> issuing a syntax error, not if the binary is executed.
Dale> Hell, I have programs seg. fault all the time, no surprise
Dale> there.
The program is not accessing an array that hasn't been defined.
If you go back to K&R you'd remember that a[i] is treated as *(a+i).
Hence, addition being commutative, it doesn't matter whether you use
a[i] or i[a], as long as one of (a, i) is an integer type and the
other a pointer to a non-void, known type.
To illustrate, try the following:
main()
{
char array[] = "ABCD";
printf ( "%c\n" , array[2] );
printf ( "%c\n" , 2[array] );
}
Both printfs will print out "C".
Regards,
- -- Raju
- --
Raj Mathur raju@...dalaya.org http://kandalaya.org/
GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F
It is the mind that moves
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 and Gnu Privacy Guard <http://www.gnupg.org/>
iD8DBQE//2rmyWjQ78xo0X8RApXMAKCZcvF94fXcrpfr7VkF4t1lwvyNYwCglduj
o1KOr6D3/vyHr+7wR+zDv5E=
=TDEf
-----END PGP SIGNATURE-----
Powered by blists - more mailing lists