[gnu.gcc.bug] problem with gcc type checking

quarles@PANIC.BERKELEY.EDU (Tom Quarles) (01/19/89)

Gcc version 1.32 on Ultrix 3.0/Vax 8650.
(Gcc version 1.26 on Ultrix 2.2/Vax 8800 does NOT have this problem)

I have a problem with gcc producing a type mismatch when it
should not (by my reading of the dpANS).  Specifically, I have :

/* test.c */
/* from one header file: */

typedef struct sIFparseTree {
	/*... stuff ... */
	int ((*IFeval)(struct sIFparseTree*,double*,double*,double*));
	/*... more stuff ...*/
} IFparseTree;

/* from another header file: */

struct ASRCinstance {
	/*... stuff ...*/
	IFparseTree *ASRCtree;
	/*... more stuff ...*/
}

/* When I attempt to call this function by: */
main() {

	struct ASRCinstance *here;
	double rhs;
	double *vals, *derivs;

	if( (*(here->ASRCtree->IFeval))(here->ASRCtree,&rhs,vals,derivs) == 0){
		/* stuff */
	}
}
/* end of test.c */

I get the warning:
	test.c:6: warning: parameter points to incomplete type

this warning I can live with, although it is quite legal and I don't know of
any way to declare this structure without getting such a warning (it would be
nice if the message weren't generated if the incomplete type being pointed 
to was the type currently being defined).  I then get:

	test.c: In function main:
	test.c:25: incompatible types in argument passing

and the compilation stops.

The only possibility I can see here is the difference between a
"struct sIFparseTree *" and an "IFparseTree" which is typedef'd 
as "struct sIFparseTree*"


	According to the latest dpANS I have (1/11/88), section 3.5.6
"A typedef declaration does not introduce a new type, only a 
synonym for the type so specified.", so the two 'incompatible types'
are not different types, simply synonyms for the same type, and
thus compatible.  The example given further down on the page
appears to make it quite explicit that this is what is intended.


Tom Quarles
quarles@ic.berkeley.edu