Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site elsie.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: 4.?BSD lint muffs enum pointer arguments (with fix) Message-ID: <5295@elsie.UUCP> Date: Fri, 22-Nov-85 14:30:03 EST Article-I.D.: elsie.5295 Posted: Fri Nov 22 14:30:03 1985 Date-Received: Sun, 24-Nov-85 05:32:02 EST Organization: NIH-LEC, Bethesda, MD Lines: 42 Keywords: BSD lint enum Index: cmd/mip/optim.c Fix Description: 4.?BSD lint gives bogus diagnostics for enum pointer arguments. Repeat-By: Create a file named "try.c" with these lines in it: enum foo {a,b,c}; try(bar) enum foo * bar; { try(bar); } Then use the command lint try.c and note the output: try, arg. 1 used inconsistently try.c(5) :: try.c(6) Fix: The problem occurs because pass 1 of the C compiler changes pointers to enums to other ilks of pointers; while this simplifies code generation for the compiler, it messes up "lint"s efforts to check types. The fix is to conditionalize a line of code in "optim.c". Here's the line from "optim.c" involved; the trade secret status of the code involved precludes a clearer posting. #ifdef OLDVERSION if( (t=BTYPE(p->in.type))==ENUMTY || t==MOETY ) econvert(p); #else #ifndef LINT if( (t=BTYPE(p->in.type))==ENUMTY || t==MOETY ) econvert(p); #endif #endif -- Lint is an Oscar Madison trademark. Bugs is a Warner Brothers trademark. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks