From owner-freebsd-stable Fri Apr 27 12:42:38 2001 Delivered-To: freebsd-stable@freebsd.org Received: from zoon.lafn.org (zoon.lafn.org [206.117.18.9]) by hub.freebsd.org (Postfix) with ESMTP id 622D237B422 for ; Fri, 27 Apr 2001 12:42:34 -0700 (PDT) (envelope-from bc979@lafn.org) Received: from [10.0.1.3] ([192.168.25.100]) by zoon.lafn.org (8.10.1/8.10.1) with ESMTP id f3RJfAV20156; Fri, 27 Apr 2001 12:41:10 -0700 (PDT) Mime-Version: 1.0 X-Sender: bc979@mail.lafn.org Message-Id: In-Reply-To: <200104271024.UAA18292@lightning.itga.com.au> References: <200104271024.UAA18292@lightning.itga.com.au> Date: Fri, 27 Apr 2001 11:48:29 -0700 To: Gregory Bond From: Doug Hardie Subject: Re: Illegal Instruction in libm - Problem solved.... Cc: stable@FreeBSD.ORG, Kris Kennaway Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 20:24 +1000 4/27/01, Gregory Bond wrote: > > There is an interesting difference in malloc. It defines the symbol >> free and if you use that symbol in your program then it tends to >> write over some part of your program. By changing the symbol in my >> program (an int) to a different name, the problem goes away and it >> works properly. I believe this behavior is new because it didn't >> have this problem in FreeBSD 4.2-RELEASE. > >Free() has been part of the malloc() package for as long as the C language has >existed (more or less). Redefining standard library names in your code is and >always has been a bug. The difference might be that under 4.2 the bug has >repeatable consequences due to different code layout in the library or >whatever. > It may always have been a bug in FreeBSD, and still is. The concept of being able to replace a library module with one from your code is fairly common in SVR4, and SunOS. I have used that many times on projects where the library module needed to be modified for a specific application. That worked under FreeBSD 2.2.x, 3.5, and 4.2 also. With 4.3 if there is no change in "size" of the object, you get no warning that the code is flawed. It just crashes in some arbritary location unrelated to the symbol issue. Only if the sizes are different do you get an interesting warning that the size of the object has been changed. -- -- Doug To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message