From: utzoo!decvax!harpo!seismo!hao!hplabs!luigi
Newsgroups: net.bugs.4bsd
Title: 4.1 C compiler bug (a new one, maybe)
Article-I.D.: hplabs.1222
Posted: Mon Feb 28 15:58:25 1983
Received: Tue Mar  1 08:47:50 1983


I just found another 4.1bsd C compiler bug, probably related to the ones
that have been mentioned about arguments to a procedure that appear from
nowhere. This one is not that glamorous, but equally subtle. Look at the
procedure foo (filthy): the argument type declaration does not realize
that guilty is not in the argument list. Strange things then clearly happen.

    /*******************/

    int guilty;	/* this declaration is necessary for the error to turn up */
    int parm;


    main(){
	foo(parm);
    }

    foo (filthy)
    short guilty;	/* this is not detected */
    {
	/* these work, but filthy is assumed to be of type int */
	filthy = 3;
	parm = filthy;

	/* these do not work; however you get a warning message */
	guilty = 3;
	parm = guilty;
    }


By the way, I found this bug accidentally in the "ld" source.
It changes a long into an int, so it has no effect on the VAX.
I wonder about other machines.

Luigi Semenzato - HP Labs