From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTP id F279E381DCE1 for ; Mon, 16 Mar 2020 23:34:10 +0000 (GMT) Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDzFJ-0003ja-Qg for gcc-help@gcc.gnu.org; Mon, 16 Mar 2020 19:34:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from gate.crashing.org ([63.228.1.57]:40385) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDzFJ-0003bb-Ip for gcc-help@gcc.gnu.org; Mon, 16 Mar 2020 19:34:09 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 02GNY7Z9016827; Mon, 16 Mar 2020 18:34:07 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 02GNY7P8016822; Mon, 16 Mar 2020 18:34:07 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 16 Mar 2020 18:34:06 -0500 From: Segher Boessenkool To: "Shrader, David Lee" Cc: "gcc-help@gcc.gnu.org" Subject: Re: question about knowing when optimization options are used Message-ID: <20200316233406.GE22482@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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 63.228.1.57 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: Mon, 16 Mar 2020 23:34:11 -0000 On Mon, Mar 16, 2020 at 11:14:25PM +0000, Shrader, David Lee via Gcc-help wrote: > Most optimizations are only enabled if an -O level is set on the command line. Otherwise they are disabled, even if individual optimization flags are specified. Yes. > The man page says to use `-Q --help=optimizers` to find out what is turned on for the different -O levels as configure-time options can make things different from the defaults shown later in that man page. However, I have found that, even when using -O0, I can turn on optimization options, at least according to the help output: You can enable the *flags*, sure, but with -O0 those flags do not do anything. Exactly as the text above says? The "even if" part. Segher