[net.lang.c] Possible C Compiler Bug?

john@wvlpdp (06/06/86)

	I am using Ultrix-11 Version 2.0 on a PDP 11/73
	and ran into a problem when trying to compile some code.
	After much tearing of hair and grinding of teeth the problem boiled down
	to the following:

This compiles:

main()
{
	A lot of code here;
	goto here;
		
	More code here;

here:
	;
}

This will not:
main()
{
	A lot of code here;
	goto here;
		
	More code here;

here:
}
	Is this a compiler bug?




John A. Ebersold 				World Video Library
ihnp4!convex!ctvax!trsvax!hal6000!wvlpdp!john	2747 Airport Freeway
						Fort Worth, Texas 76111
						(817)-831-3811

ark@alice.UucP (Andrew Koenig) (06/09/86)

> This compiles:

> main()
> {
>	A lot of code here;
>	goto here;
>		
>	More code here;
>
> here:
> 	;
> }
>
> This will not:
> main()
> {
>	A lot of code here;
>	goto here;
>		
>	More code here;
>
> here:
> }
>	Is this a compiler bug?

No it isn't.  A label must come before a statement.  } isn't a statement.

mjs@sfsup.UUCP (M.J.Shannon) (06/09/86)

In article <3400004@wvlpdp> john@wvlpdp writes:
>This will not [compile]:
>main()
>{
>	/* valid C here */
>	goto here;
>	/* more valid C */
>here:
>}
>John A. Ebersold

No, this is not a compiler bug.  A label must precede a statement, and you
have no statement following your label.
-- 
	Marty Shannon
UUCP:	ihnp4!attunix!mjs
Phone:	+1 (201) 522 6063

Disclaimer: I speak for no one.

"If I never loved, I never would have cried." -- Simon & Garfunkel