Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: C Compiler bugs (was Re: Speaking of ksh) Message-ID: <8097@brl-smoke.ARPA> Date: 16 Jun 88 07:51:33 GMT References: <15085@tut.cis.ohio-state.edu> <4421@haddock.ISC.COM> <8001@ncoast.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 In article <8001@ncoast.UUCP> allbery@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