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 57E4C38582B9 for ; Thu, 4 Jan 2024 15:04:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57E4C38582B9 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57E4C38582B9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704380671; cv=none; b=kyOVv/hH636pXoDupByiRn6FJjRLmdtBJtlZWiSTceN/dAfApt2G1owTz+f1fvxZJxvEL/7dg6uD7k1wJ8WV37fTVhBwLwhAksq4hc9XyOyHOfTdTzubQR+3mM7lduUolLqN4NE6RJEJML0mRljPe9zODBqi2CGVs7zDUc1RIgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704380671; c=relaxed/simple; bh=7HC9rEY22pjgpsQ4grDXiV9Fh0kP/oy+y0bzAAdO5P0=; h=Date:From:To:Subject:Message-ID:Mime-Version; b=mwRUDK5FpT+R73k46ol3GrOWz1npnmmhrLSTaYhyycT4Ya+Int1Iak1QBe/ar8lGDLRCUZKrYt1kOrcS7byaFXEGwbt/Jk2FSX2suun81999K7xIVQvFCbj1vjSSpqInxaZ21YgEaYLgpqinC1X1i/BeaCZrw8vHWuwfzQgz0U8= ARC-Authentication-Results: i=1; server2.sourceware.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 404F3QLe028344; Thu, 4 Jan 2024 09:03:26 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 404F3QCP028343; Thu, 4 Jan 2024 09:03:26 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 4 Jan 2024 09:03:25 -0600 From: Segher Boessenkool To: David Brown Cc: gcc-help@gcc.gnu.org Subject: Re: pragma GCC optimize prevents inlining Message-ID: <20240104150325.GA19790@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=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Jan 04, 2024 at 03:51:23PM +0100, David Brown via Gcc-help wrote: > This is a general limitation in GCC, as far as I know. I have come > across it myself (in my case it was the "-fwrapv" flag). As far as I > remember from a previous discussion long ago, there is no easy workaround. What are the expected semantics? That depends on the use case, so on what the user expects. If the compiler inlines the function and picks either set of options, it may do something the user wanted to avoid. Not good. The user can always write exactly what the user wants, instead :-) Maybe we could have an option -fallow-inlining-that-changes-semantics? Not sure if people will actually find that useful, but at least they cannot say they weren't warned if they use that ;-) Segher