Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site sdchema.sdchema.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!hplabs!sdcrdcf!sdcsvax!sdcc3!sdchema!tps From: tps@sdchema.UUCP (Tom Stockfisch) Newsgroups: net.lang.c,net.bugs.4bsd Subject: Re: bug in cc (???) Message-ID: <441@sdchema.sdchema.UUCP> Date: Wed, 4-Sep-85 16:58:04 EDT Article-I.D.: sdchema.441 Posted: Wed Sep 4 16:58:04 1985 Date-Received: Sun, 8-Sep-85 16:20:38 EDT References: <502@lasspvax.UUCP> Reply-To: tps@sdchema.UUCP (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 57 Xref: watmath net.lang.c:6281 net.bugs.4bsd:1743 [] Todd Olson writes that the 4.2 C compiler can't handle int n; struct foo I think there are many bugs in the way 4.2 handles passing whole structures. Consider the following bug which prevents one from treating complex numbers as primitives. The gyst is that you can't immediately access a member of a structure returned by a function. Very frustrating. Now, do the same but let the FIRST array subscript be the integer variable. f(*X[n][0]); The first two forms compile and run fine. The third form gives the error message: "ccbug.c", line 15: compiler error: stuck starg Further, doing the dereferencing and then the function call works just fine. y = *X[n][0]; f(y); or f(y=*X[n][0]); REPEAT BY: compile this program ---------------------------------------------------------------------- struct S { int a; int b; } *X[2][2], IS = { 1, 2 }; main() { int f(); int n; n = 0; X[0][0] = &IS; f( *X[n][0] ); /* cc complains on this line */ } int f(m) struct S m; { printf("%d %d\n", m.a, m.b); } ---------------------------------------------------------------------- BTW: 'lint -ph' produces no messages -- Todd Olson ARPA: olson@lasspvax -- or -- olson%lasspvax@cu-arpa.cs.cornell.edu UUCP: {ihnp4,allegra,...}!cornell!lasspvax!olson US Mail: Dept Physics, Clark Hall, Cornell University, Ithaca, New York 14853