Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.lang.c Subject: Re: C Compiler bugs (was Re: Speaking of ksh) Message-ID: <8001@ncoast.UUCP> Date: 15 Jun 88 03:05:57 GMT References: <15085@tut.cis.ohio-state.edu> <4421@haddock.ISC.COM> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.lang.c Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 28 As quoted from <4421@haddock.ISC.COM> by karl@haddock.ISC.COM (Karl Heuer): +--------------- | In article <15085@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes: | >Then there was the bug where if you had a structure declaration right before | >main and forget to end it with a ; the program would core dump on exit: | > struct blob { int a, b, c; } /* missing ; */ | > main(argc, argv) ... | | Why should it be considered a "compiler bug" when a syntactically correct | program containing a user bug dumps core? It seems to me that the appropriate | "fix" is to make sure that lint complains about the mismatched declaration. | | Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint +--------------- (blink) Whoops! Mr. Heuer just earned his title. That *is* a valid declaration: it says that the function main() returns a (struct blob), and declares the (struct blob) at the same time. Good point. ...but why does the code dump core? Admitted, the cleanup code in crt0 will dosciver a type mismatch, but how many programs exit by return'ing from main? If it happened during an exit(), it's a legitimate bug somewhere. (If it happened in crt0, then it's an artifact of the compiler's method of returning structs.) -- Brandon S. Allbery | "Given its constituency, the only uunet!marque,sun!mandrill}!ncoast!allbery | thing I expect to be "open" about Delphi: ALLBERY MCI Mail: BALLBERY | [the Open Software Foundation] is comp.sources.misc: ncoast!sources-misc | its mouth." --John Gilmore