bug in cc (???)
    Tom Stockfisch 
    tps at sdchema.UUCP
       
    Thu Sep  5 06:58:04 AEST 1985
    
    
  
[]
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 at lasspvax  -- or --  olson%lasspvax at cu-arpa.cs.cornell.edu
UUCP: {ihnp4,allegra,...}!cornell!lasspvax!olson
US Mail: Dept Physics, Clark Hall, Cornell University, Ithaca, New York 14853
    
    
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list