bug in cc (???)

Todd Olson olson at lasspvax.UUCP
Mon Sep 2 04:54:03 AEST 1985


[]

    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 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