From owner-svn-src-all@FreeBSD.ORG Mon May 5 21:24:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A7C843F; Mon, 5 May 2014 21:24:43 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 565FE89C; Mon, 5 May 2014 21:24:42 +0000 (UTC) Received: from [192.168.0.7] (cpc14-cmbg15-2-0-cust307.5-4.cable.virginm.net [82.26.1.52]) (authenticated bits=0) by theravensnest.org (8.14.7/8.14.7) with ESMTP id s45LObCa035099 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 5 May 2014 21:24:39 GMT (envelope-from theraven@FreeBSD.org) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Subject: Re: svn commit: r265367 - head/lib/libc/regex From: David Chisnall In-Reply-To: <5367EB54.1080109@FreeBSD.org> Date: Mon, 5 May 2014 22:21:59 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <3C7CFFB7-5C84-4AC1-9A81-C718D184E87B@FreeBSD.org> References: <201405051641.s45GfFje086423@svn.freebsd.org> <5367CD77.40909@freebsd.org> <5367EB54.1080109@FreeBSD.org> To: Pedro Giffuni X-Mailer: Apple Mail (2.1874) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andrey Chernov X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2014 21:24:43 -0000 On 5 May 2014, at 20:49, Pedro Giffuni wrote: > Yes, but I reverted it because there are other ways to check for = overflows without the performance hit. Do we have a good reusable routine for doing this somewhere? Clang and = gcc both have some idiom recognisers that try to spot when people are = attempting to do this. Clang also has a builtin, which would be good to = use when available. Overflow checking is very cheap on modern CPUs = (add, branch on carry), so it would be nice if we could start looking = for this malloc() and realloc() pattern and replacing the multiply with = something that checks for the error. David