C Compiler bugs (was Re: Speaking of ksh)

Karl Heuer karl at haddock.ISC.COM
Sat Jun 11 02:52:54 AEST 1988


(Since the question was directed toward me, I'll take the liberty of replying
in public and hope that nobody else does so.)

In article <532 at wrs.UUCP> owen at wrs.UUCP (Owen DeLong) writes:
>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), ...

The point is that there is NO SYNTAX ERROR in the program.  The code fragment
  struct foo {...} main() {...}
is a perfectly valid declaration of a function named "main" whose return type
is "struct foo {...}".  It happens not to be what the user intended, but it's
still syntactically correct.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list