From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8844 invoked by alias); 14 Nov 2002 20:46:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8815 invoked by uid 71); 14 Nov 2002 20:46:03 -0000 Date: Wed, 20 Nov 2002 23:03:00 -0000 Message-ID: <20021114204603.8814.qmail@sources.redhat.com> To: bkoz@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Gabriel Dos Reis Subject: Re: libstdc++/8230: Buggy allocator behaviour Reply-To: Gabriel Dos Reis X-SW-Source: 2002-11/txt/msg00726.txt.bz2 List-Id: The following reply was made to PR libstdc++/8230; it has been noted by GNATS. From: Gabriel Dos Reis To: Benjamin Kosnik Cc: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, jkanze@caicheuvreux.com, gcc-gnats@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: libstdc++/8230: Buggy allocator behaviour Date: 14 Nov 2002 21:39:50 +0100 Benjamin Kosnik writes: | See attached patch for a way to fix this with the pool allocators. I agree with your patch. The following comment is for possible improvements. What about using if (__builtin_expect(__ret == 0, 0)) __throw_bad_alloc("allocate::allocate"); ? That gives a hint to the compiler that the branch is expected to be taken very unfrequently, and it should make scheduling accordingly. In general, I would like to see us starting using use __builtin_expect() at places where we do checks for limits cases. Thoughts? -- Gaby