🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #551

Strange compiler bug

#551
From: Mark Stevans
Date: Wed, 29 Jul 1987 18:07
39 lines
1464 bytes
If you attempt to declare a function argument that is not present in the
argument list, like in the following program:

	main()
	{
		bar(3);
	}

	bar(contect)
	int context;
	{
	}

the C compilers will give an error message about "declared argument context"
not found.  However, the following program:

	int context;

	main()
	{
		bar(3);
	}

	bar(contect)
	int context;
	{
	}

passes both "cc" and "lint" on both System V and 4.2bsd without giving any
messages to inform you that you misspelled "context" as "contect".  The
compiler seems to think that there are two arguments: context and contect.
Lint will tell you that you are hiding your global, and that the two arguments
of bar, context and contect, are unused.

I believe this is a bug.  In fact, the above situation was actually
encountered by a colleague, so this is not a purely theoretical issue.

					Mark "Bugsy" Stevans
					cci632!mark
Technical Details
Message-ID: <1454@cci632.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!rochester!ritcv!cci632!mark

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!rochester!ritcv!cci632!mark
From: mark@cci632.UUCP (Mark Stevans)
Newsgroups: comp.bugs.sys5,comp.bugs.4bsd
Subject: Strange compiler bug
Message-ID: <1454@cci632.UUCP>
Date: Wed, 29-Jul-87 14:07:51 EDT
Article-I.D.: cci632.1454
Posted: Wed Jul 29 14:07:51 1987
Date-Received: Fri, 31-Jul-87 05:14:42 EDT
Organization: CCI, Communications Systems Division, Rochester, NY
Lines: 39
Keywords: bug compiler argument