From owner-freebsd-current@FreeBSD.ORG Wed Jul 11 07:39:01 2012 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ACBC7106566B; Wed, 11 Jul 2012 07:39:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id 62AE88FC15; Wed, 11 Jul 2012 07:39:01 +0000 (UTC) Received: from [192.168.0.6] (spaceball.home.andric.com [192.168.0.6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 45DB15C37; Wed, 11 Jul 2012 09:39:00 +0200 (CEST) Message-ID: <4FFD2D94.9040805@FreeBSD.org> Date: Wed, 11 Jul 2012 09:39:00 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120619 Thunderbird/14.0 MIME-Version: 1.0 To: Pedro Giffuni References: <4FFCF5F8.6060104@FreeBSD.org> In-Reply-To: <4FFCF5F8.6060104@FreeBSD.org> X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-current@FreeBSD.org Subject: Re: [CFT] Add -Wbounded to gcc X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2012 07:39:01 -0000 On 2012-07-11 05:41, Pedro Giffuni wrote: > I have a patch from OpenBSD that adds -Wbounded to gcc: > > http://people.freebsd.org/~pfg/patches/patch-gcc-bounded > > Unfortunately it breaks world, or at least binutils, at this time: > > _________ > ... > cc1: warnings being treated as errors > peigen.c: In function '_bfd_pei_swap_aux_in': > peigen.c:241: warning: array size (14) smaller than bound length (18) > peigen.c:241: warning: array size (14) smaller than bound length (18) > peigen.c: In function '_bfd_pei_swap_aux_out': > peigen.c:314: warning: array size (14) smaller than bound length (18) > peigen.c:314: warning: array size (14) smaller than bound length (18) > *** Error code 1 > > Stop in /usr/src/gnu/usr.bin/binutils/libbfd. > *** Error code 1 > > Stop in /usr/src/gnu/usr.bin/binutils. > ___________ > > OpenBSD has a fix but before attempting to clean this, and whatever > else would break, I can't help but ask: is it worth it? Does it catch any really interesting bound overruns? If the number of false positives is very large, then it generally isn't worth the pain. Or the option should be turned off by default, and only enabled for WARNS=some_arbitrary_high_number. That said, fixing binutils (and particularly libbfd, which is what you are seeing here) is rather hopeless, it should be compiled with a low WARNS= setting anyway. :)