[net.unix-wizards] lint bug

aeb@mcvax.UUCP (Andries Brouwer) (08/25/83)

A program like
	extern long lseek();
	
	main(){
	        (void) lseek(0, 0L, 0);
	}
causes lint (BSD 4.1c) when called as  lint -a prog.c  to complain
	prog.c:
	prog.c(4): warning: long assignment may lose accuracy
which seems fairly ridiculous.
The following change fixes this.
$ diff lint.c /usr/src/usr.bin/lint/lint.c
648,649c648
<               if( aflag && (tl==LONG || tl==ULONG)
<                         && (t!=LONG && t!=ULONG && t!=UNDEF) ){
---
>               if( aflag && (tl==LONG||tl==ULONG) && (t!=LONG&&t!=ULONG) ){
-- 
      Andries Brouwer -- Math. Centr., Amsterdam -- {philabs,decvax}!mcvax!aeb

achut@qsi03.UUCP (Achut Reddy) (12/31/83)

The following C program will cause lint to crash with a core dump:

	#define macro()	 (0)

	int macro[];

	main()
	{
		x=macro;
	}

The problem is in lint, not the C pre-processor, because the C compiler
has no trouble with it.
-- 
				Achut Reddy
				sdcrdcf!trw-unix!scgvaxd!qsi03!achut

gwyn%brl-vld@sri-unix.UUCP (01/04/84)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

UNIX System V lint has no problem with the example you gave:

test.c: 3: macro: argument mismatch
test.c: 7: macro: argument mismatch
test.c: 7: macro: unterminated macro call

test.c
==============
(3)  syntax error
(7)  x undefined
(8)  syntax error