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 2F167385842C for ; Wed, 9 Feb 2022 17:00:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F167385842C 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 219GxL0X028980; Wed, 9 Feb 2022 10:59:21 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 219GxLsr028979; Wed, 9 Feb 2022 10:59:21 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 9 Feb 2022 10:59:21 -0600 From: Segher Boessenkool To: Jonathan Wakely Cc: Krishna Narayanan , gcc-help Subject: Re: Extended doubt regarding the bug 93432 Message-ID: <20220209165921.GN614@gate.crashing.org> References: 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, 09 Feb 2022 17:00:23 -0000 On Tue, Feb 08, 2022 at 05:37:12PM +0000, Jonathan Wakely via Gcc-help wrote: > It warns with -O1, which is the documented behaviour: > > The effectiveness of some warnings depends on optimizations also > being enabled. For example -Wsuggest-final-types is more > effective with link-time optimization and -Wmaybe-uninitialized does > not warn at all unless optimization is enabled. > > So no, I don't think it' a bug. GCC is behaving as designed. Ideally it > would be better at warning without optimization, but changing that would be > hard. GCC does not execute most of its code at -O0. This is important for speed of course, but much more importantly it also allows us to use -O0 when other optimisation levels crash or generate wrong code. This is useful for the compiler developers of course, but it also is an important workaround for users, when bad things happen. Segher