C Compiler bugs (was Re: Speaking of ksh)
Owen DeLong
owen at wrs.UUCP
Thu Jun 9 12:09:21 AEST 1988
In article <4421 at haddock.ISC.COM> karl at haddock.ima.isc.com (Karl Heuer) writes:
>In article <15085 at tut.cis.ohio-state.edu> lvc at 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 at 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
More information about the Comp.lang.c
mailing list