Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lasspvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!cornell!lasspvax!olson From: olson@lasspvax.UUCP (Todd Olson) Newsgroups: net.lang.c,net.bugs.4bsd Subject: bug in cc (???) Message-ID: <502@lasspvax.UUCP> Date: Sun, 1-Sep-85 14:54:03 EDT Article-I.D.: lasspvax.502 Posted: Sun Sep 1 14:54:03 1985 Date-Received: Wed, 4-Sep-85 06:41:49 EDT Reply-To: olson@lasspvax.UUCP (Todd Olson) Organization: LASSP, Cornell University Lines: 69 Xref: watmath net.lang.c:6243 net.bugs.4bsd:1729 [] In the process of writing a human interface for a graphics program I stumbled across what I think is a bug in the 4.2bsd cc. I've removed the extra code and simplified the data structures to isolate the error. I'd like to know if the rest of you out there suffer from this 'bug' and to who's attention the problem should be brought for fixing (Is it to late for 4.3 to catch, (if it hasn't already)??) SYSTEM: 4.2bsd on a VAX 11/750 COMMAND: cc DESCRIPTION: Consider a 2-dim array of pointers to a structure. X Consider a function that is passed a structure. f Now, get the structure that is passed to the function by dereferencing an element of the array selected by constant subscripts. f(*X[0][0]); Now, do the same but let the SECOND array subscript be an integer variable. f(*X[0][n]); 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