[comp.bugs.4bsd] Bug in various lints!

maart@cs.vu.nl (09/06/88)

What does YOUR lint say about the following program?

% cat c.c
main(argc, argv)
int	argc;
char	**argv;
{
	while (*argv != argv[1] && (*argv = argv[1]) && (argc = 0) || (*++argv
		&& (**argv && ((++argc)[*argv] && (**argv <= argc[*argv] ||
/*7*/		(**argv += argc[*argv] -= **argv = argc[*argv] - **argv)) &&
		--argv || putchar(**argv) && ++*argv--) || putchar(10))))
		;
}
%

Sun3 with Sun UNIX 4.2 Release 3.5:

	% /usr/bin/lint -abchpx c.c
	%

Sun4 with SunOS Release Sys4-3.2:

	% /usr/bin/lint -abchpx c.c
	lint: Option -p not recognized
	% ^p^
	/usr/bin/lint -abchx c.c
	%

On our other sun4 (same OS) the response was:

	lint: Fatal error in lint2: Bus error (core dumped)

VAX11/750 with 4.3 BSD UNIX:

	% /usr/bin/lint -abchpx c.c
	%

PDP11/44 with 2.9BSD:

	% /usr/bin/lint -abchpx c.c
	%

Mantra m68000 with Sys5 V3:

	% /usr/bin/lint -abchpx c.c
	c.c
	==============
	(10)  warning: main() returns random value to invocation environment

 
	==============
	name used but not defined
	    putcha      c.c(8)
	%

Whereas the output should be something like:

	c.c(7): warning: evaluation order undefined

The only lint to catch this was ACK (The Amsterdam Compiler Kit) lint (not
generally available right now, I've been told).
(Yes, c.c was a winning entry in the IOCCC and I was very satisfied that lint
didn't complain about it... What would it do?)
Thanks to Leendert van Doorn, Ceriel Jacobs and Dick Grune for pointing out
the bug.

maart@cs.vu.nl (Maarten Litmaath) (09/06/88)

In article <1344@solo12.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
\Mantra m68000 with Sys5 V3:
\
\	% /usr/bin/lint -abchpx c.c
                         ^^^^^^
That should have been only '-p', of course, due to those nice Sys5 semantics.
-- 
    Alles klar,                       |Maarten Litmaath @ Free U Amsterdam:
                   Herr Kommissar?    |maart@cs.vu.nl, mcvax!botter!maart