From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 834663858C2C for ; Wed, 2 Feb 2022 18:34:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 834663858C2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 212IXYo6026532; Wed, 2 Feb 2022 12:33:34 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 212IXYud026531; Wed, 2 Feb 2022 12:33:34 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 2 Feb 2022 12:33:34 -0600 From: Segher Boessenkool To: Jonathan Wakely Cc: Martin Sebor , Martin Sebor via Gcc-help , Dumitru Ceara , Richard Sandiford Subject: Re: Potentially false-positive -Wstringop-overflow= warning with gcc >= 11.1 Message-ID: <20220202183334.GA614@gate.crashing.org> References: <8d42151f-7be2-4d67-5b46-a83ba55d5c1c@redhat.com> <20220128152748.GD614@gate.crashing.org> <478a5194-c8aa-2be7-e4aa-f0d441cbfac0@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Feb 2022 18:34:40 -0000 On Wed, Feb 02, 2022 at 10:12:44AM +0000, Jonathan Wakely wrote: > On Tue, 1 Feb 2022 at 23:55, Martin Sebor via Gcc-help > > There's plenty of literature out there that explains this, including > > the GCC manual, so I'd expect most C/C++ programmers to understand > > that. > > I disagree. So does the manual: > > -Warray-bounds > -Warray-bounds=n > This option is only active when -ftree-vrp is active > (default for -O2 and above). It > warns about subscripts to arrays that are always out of > bounds. This warning is > enabled by -Wall. Yes, that is wrong as written. Please open a PR? > If we're going to claim that it's common knowledge that warnings are > always contextual and not definite, can we not use language like > "always out of bounds"? How else am I supposed to read that other than > "always"? Always, under specific conditions? That's not what the word > means. I agree. It is essentially always possible to phrase an error to be friendlier as well as much more correct at the same time, without being much more verbose. This takes effort, but it is an investment that pays off greatly and immediately. Segher