thomas (03/27/83)
There is a very annoying bug in lint. Given the two input files shown below, lint produces the error messages b, arg. 1 used inconsistently tst2.c(8) :: tst1.c(7) b, arg. 2 used inconsistently tst2.c(8) :: tst1.c(7) a, arg. 1 used inconsistently tst1.c(5) :: tst2.c(10) Seems that even though the type foo is declared to be a struct foo in both files, the fact that struct foo is actually defined in one file but not the other causes lint to think that the arguments are of differing types. Anybody know a fix for this? =Spencer tst1.c: typedef struct foo foo; a(f) foo * f; { foo * g = (foo *)0; b(f, g); } tst2.c: typedef struct foo { int a; } foo; b(f, g) foo * f, * g; { f = g; a(f); }
archiel@teklds.UUCP (Archie Lachner) (01/11/84)
The following simple function illustrates a problem I am having with lint: union foo { int *intptr; char *chrptr; float *fltptr; }; test() { register union foo reg; *(reg.intptr) = 1; return; } This compiles with no complaints from cc. However, I get the following message from lint: test.c: test.c(10): can't take & of reg While it is true that the address of a register cannot be computed, such a computation should not be necessary during the execution of the above code. Does this look like a bug in lint? Does anybody out there in net land have any ideas or suggestions? -- Archie Lachner uucp: {ucbvax,decvax,pur-ee,cbosg,ihnss}!tektronix!teklds!archiel CSnet: archiel@tek ARPAnet: archiel.tek@rand-relay
decot@cwruecmp.UUCP (Dave Decot) (02/08/84)
You are right, this is a bug. Pcc (and thus lint) probably understands union and struct members by substituting *((char*)(&str)+memboff) for str.memb, where memboff is the byte offset of member memb into template str. Note that the offsets of members of unions is always zero, so this problem should not occur. Most compilers will not take advantage of the "hint" to put unions or structs into registers anyway, because this greatly complicates code generation. However, it is still illegal to ask for the address of anything declared to have storage class "register", whether or not one is actually used. Dave Decot "Non-Americans are people, too." decvax!cwruecmp!decot (Decot.Case@rand-relay)