Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site winston.UUCP Path: utzoo!utcsri!ubc-vision!winston!wolfe From: wolfe@winston.UUCP (Peter Wolfe) Newsgroups: net.bugs.4bsd Subject: Bug in cc(1), doesn't catch syntax error Message-ID: <167@winston.UUCP> Date: Thu, 5-Dec-85 14:16:29 EST Article-I.D.: winston.167 Posted: Thu Dec 5 14:16:29 1985 Date-Received: Fri, 6-Dec-85 21:40:27 EST Organization: New Media Technologies, Burnaby, BC, CANADA Lines: 57 Description: cc(1) will generate incorrect code if you declare a forward reference and inadvertantly have an argument inside the (). No complaints or warnings just wrong code. Lint does not really catch it etiher. Repeat-By: extern int pw(ptr); <<<<<<<<---------------- admittly illegal int pw(d, l) char *d; short l; { pw(d, l); } Produces: LL0: .data .text .align 1 .globl _pw _pw: .word L12 jbr L14 L15: cvtwl 12(ap),-(sp) <<<<<<<--------------- should be 8 pushl 8(ap) <<<<<<<--------------- should be 4 calls $2,_pw ret .set L12,0x0 L14: jbr L15 .data Lint (lint test.c) says the following: test.c: test.c(6): warning: argument ptr unused in function pw pw: variable # of args. test.c(6) :: test.c(7) pw, arg. 1 used inconsistently test.c(6) :: test.c(7) pw, arg. 2 used inconsistently test.c(6) :: test.c(7) Fix: Here I am out of my depth. Probably this will all be fixed when pcc gets its ANSI standard upgrade? -- Peter Wolfe New Media Technologies ..decvax!microsoft!ubc-vision!winston!wolfe ..ihnp4!alberta!ubc-vision!winston!wolfe