Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!ames!amdahl!rtech!wrs!owen From: owen@wrs.UUCP (Owen DeLong) Newsgroups: comp.lang.c Subject: Re: C Compiler bugs (was Re: Speaking of ksh) Message-ID: <532@wrs.UUCP> Date: 9 Jun 88 02:09:21 GMT References: <15085@tut.cis.ohio-state.edu> <4421@haddock.ISC.COM> Reply-To: owen@wrs.UUCP (Owen DeLong) Organization: Wind River Systems, Emeryville, CA Lines: 28 In article <4421@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes: >In article <15085@tut.cis.ohio-state.edu> lvc@tut.cis.ohio-state.edu (Lawrence V. Cipriani) writes: >>Following up from comp.unix.wizards are amusing C Compiler bugs: >>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 >Followups to comp.lang.c. Tell me, Karl, where do you see the bug causing the program to dump core? I get the impression that the bug is in the compiler, and the compiler which doesn't need a ; (noted as missing) dumped core upon trying to return from function main. I see this as definitely being a compiler bug, particularly if you consider the code to be correct. It is conceivable to call the code incorrect (syntax error due to missing semicolon), but I would say that the compiler should actually accept the closing brace on a compound statement as an implied ; afterwards. If I'm wrong, flame me...I'll learn that way. If I'm not, we've all learned something. I would like to see the rest of the program which you must have seen to say it was a user bug. Owen