From owner-cvs-src@FreeBSD.ORG Wed Apr 5 19:23:06 2006 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A0BAC16A401; Wed, 5 Apr 2006 19:23:06 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from lh.synack.net (lh.synack.net [204.152.188.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D2E643D46; Wed, 5 Apr 2006 19:23:06 +0000 (GMT) (envelope-from jasone@FreeBSD.org) Received: by lh.synack.net (Postfix, from userid 100) id 3106B5E4921; Wed, 5 Apr 2006 12:23:06 -0700 (PDT) Received: from [192.168.168.201] (moscow-cuda-gen2-68-64-60-20.losaca.adelphia.net [68.64.60.20]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lh.synack.net (Postfix) with ESMTP id 5C3185E490F; Wed, 5 Apr 2006 12:23:04 -0700 (PDT) Message-ID: <44341915.9060007@FreeBSD.org> Date: Wed, 05 Apr 2006 12:23:01 -0700 From: Jason Evans User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Jeremy References: <200604051846.k35IkOb1025667@repoman.freebsd.org> <20060405191247.GM699@turion.vk2pj.dyndns.org> In-Reply-To: <20060405191247.GM699@turion.vk2pj.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.5 (2005-11-28) on lh.synack.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL autolearn=no version=3.0.5 Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libc/stdlib malloc.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2006 19:23:06 -0000 Peter Jeremy wrote: > On Wed, 2006-Apr-05 18:46:24 +0000, Jason Evans wrote: > >>jasone 2006-04-05 18:46:24 UTC >> >> FreeBSD src repository >> >> Modified files: >> lib/libc/stdlib malloc.c >> Log: >> Add an unreachable return statement, in order to avoid a compiler warning >> for non-standard optimization levels. > > > This just masks the problem. assert(0) is not guaranteed to abort the > program because you can disabled asserts using NDEBUG. I didn't make the change with any intention of catching errors in the non-debug case. The change is purely about keeping the compiler quiet. Note that if the assert(0) is hit, it is due to some issue that occurred an arbitrary amount of time earlier (like a double free), so catching this particular case in non-debug versions of malloc is essentially useless, since there's no way to associate cause and effect. If calling abort() allows the compiler to do a better job of optimization than with the unreachable return statement, then there's a case for changing this. Otherwise, I don't see why it matters. Jason