Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: C Problem (or, GOTOs considered harmful) Message-ID: <8839@mimsy.UUCP> Date: Wed, 30-Sep-87 11:45:12 EDT Article-I.D.: mimsy.8839 Posted: Wed Sep 30 11:45:12 1987 Date-Received: Mon, 5-Oct-87 01:19:46 EDT References: <129@hotlg.ATT> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 34 Keywords: labels scope goto symtab In article <129@hotlg.ATT> nz@hotlg.ATT (Neal Ziring) writes: >One of the developers came upon a very interesting problem with >our C cross-compiler the other day. The compiler runs on a VAX >(SysV.2) and produces code for the M68000/10. ... [A compile] bombed >with a message about the symbol ``cleanup'' being undefined. That >symbol was his goto label -- and it appeared right there in the >file. ... Why was it that I, the compiler support person, could >not duplicate the problem when I tried to write some little test >programs. Why was it that whenever the number of declarations in >the dozens of #included header files was changed, the problem would >go away? Why was it that other files with similar structure did >not evoke the fatal-error behaviour? It sounds almost as though someone copied my `clearst' speedup for the 4.2BSD VAX PCC. There is a bug in it. It shows up only with goto labels, and possibly `extern' declarations that appear inside functions, and only when the symbol table becomes moderately full and the goto label hashes to the same slot as an already-declared local variable. When the local variable is removed from the symbol table because it went out of scope, displaced symbols (i.e., the goto label) are moved back to their proper slots. Alas, I put the addresses of the symbols on a scope chain (`schain') and forgot to alter the appropriate chain as well. My bug usually results in compiler error: schain botch rather than a bogus compile. Sorry about that. (Someone will post a fix soon.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris