🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2165

problem with gcc type checking

#2165
From: Tom Quarles
Date: Thu, 19 Jan 1989 02:22
64 lines
2321 bytes
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
Technical Details
Message-ID: <8901190222.AA26200@panic.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bbn!mailrus!tut.cis.ohio-state.edu!PANIC.BERKELEY.EDU!quarles

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bbn!mailrus!tut.cis.ohio-state.edu!PANIC.BERKELEY.EDU!quarles
From: quarles@PANIC.BERKELEY.EDU (Tom Quarles)
Newsgroups: gnu.gcc.bug
Subject: problem with gcc type checking
Message-ID: <8901190222.AA26200@panic.berkeley.edu>
Date: 19 Jan 89 02:22:00 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 64