From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16188 invoked by alias); 8 Mar 2011 15:36:57 -0000 Received: (qmail 16028 invoked by uid 22791); 8 Mar 2011 15:36:56 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 15:36:47 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p28Faaa3004977 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 8 Mar 2011 10:36:36 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p28FaaFp024762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 8 Mar 2011 10:36:36 -0500 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p28FaZ9p027206; Tue, 8 Mar 2011 16:36:35 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p28FaWCU027205; Tue, 8 Mar 2011 16:36:32 +0100 Date: Tue, 08 Mar 2011 15:36:00 -0000 From: Jakub Jelinek To: Ian Lance Taylor Cc: Rainer Orth , Jim Meyering , "Joseph S. Myers" , gcc-patches@gcc.gnu.org, java-patches@gcc.gnu.org Subject: Re: [PATCH v2] Re: avoid useless if-before-free tests Message-ID: <20110308153632.GB30899@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <87zkp9zmq0.fsf@rho.meyering.net> <877hc9r8w6.fsf_-_@rho.meyering.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2011-q1/txt/msg00054.txt.bz2 On Tue, Mar 08, 2011 at 07:28:37AM -0800, Ian Lance Taylor wrote: > Rainer Orth writes: > > >> I found no ChangeLog for libgo and no other libgo-related entries. > >> I suspect that means I should omit this change because it belongs upstream. > > > > Indeed, cf. libgo/README*. I've Cc'ed Ian who maintains this part of > > GCC. > > Yes, libgo is upstream but in any case I'd prefer that you not make the > change to libgo/runtime/go-select.c. I'm aware that free (NULL) is a > no-op but I wrote the code that way because it is extremely unlikely > that allocated_buffer != NULL. I am simply inlining the common case. > Thanks. I guess such reason is sometimes legitimate, but it would be nice (and better for generated code) to make it explicit in that case, i.e. if (__builtin_expect (allocated_buffer != NULL, 0)) free (allocated_buffer); could be a sign for anyone coming after Jim that this case is on purpose and should be left as is. allocated_buffer != NULL is normally predicted as true, not false. Jakub