luigi (02/28/83)
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