C Compiler bugs (was Re: Speaking of ksh)
Doug Gwyn
gwyn at brl-smoke.ARPA
Thu Jun 16 17:51:33 AEST 1988
In article <8001 at ncoast.UUCP> allbery at ncoast.UUCP (Brandon S. Allbery) writes:
>...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?
Most of mine do.
>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.)
Yes, the compiler is allowed to use a different stack layout in order
to provide room for the struct to be returned. If the function definition
does not have the same "shape", it could easily pick up its arguments
from the wrong place, or several other similar things can go wrong.
"Don't bother to analyze a folly -- merely ask youself
what it accomplishes." - Ellsworth M. Toohey
More information about the Comp.lang.c
mailing list