Xref: utzoo comp.bugs.2bsd:100 comp.bugs.4bsd:941 comp.lang.c:12386 Path: utzoo!attcan!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart@cs.vu.nl From: maart@cs.vu.nl Newsgroups: comp.bugs.2bsd,comp.bugs.4bsd,comp.lang.c Subject: Bug in various lints! Message-ID: <1344@solo12.cs.vu.nl> Date: 6 Sep 88 00:53:08 GMT Sender: maart@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatica, Amsterdam Lines: 65 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.