[comp.bugs.sys5] bug in C compiler

ekrell@ulysses.homer.nj.att.com (Eduardo Krell[arm]) (04/18/88)

The following bug is present in both the 4.3 BSD and the System V compilers
(and I would guess all other pcc-based compilers as well).

If you forget the "goto" keyword in a goto statement, the compiler doesn't
complain. Try the following:

main(){
foo:
	foo;		/* this was intended to be a "goto foo;" statement */
}

I know labels and variables share the same name space, but this is not
legal C code.

I discovered this bug when I recompiled a program with the GNU C Compiler,
which issued an undeclared variable error.
-- 
    
    Eduardo Krell                   AT&T Bell Laboratories, Murray Hill

    {ihnp4,ucbvax}!ulysses!ekrell	ekrell@ulysses.att.com