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 BFFD53AA8C1B for ; Thu, 5 Aug 2021 15:07:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BFFD53AA8C1B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail 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 175F6oWP008613; Thu, 5 Aug 2021 10:06:50 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 175F6oNo008612; Thu, 5 Aug 2021 10:06:50 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 5 Aug 2021 10:06:49 -0500 From: Segher Boessenkool To: Prathamesh Kulkarni Cc: Richard Earnshaw , GCC Development Subject: Re: [RFC] Adding a new attribute to function param to mark it as constant Message-ID: <20210805150649.GO1583@gate.crashing.org> References: <20210803215538.GU1583@gate.crashing.org> <20210804101722.GD1583@gate.crashing.org> <20210804124619.GF1583@gate.crashing.org> <07900439-bc29-1f24-2522-4d2d79a86d4f@foss.arm.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=-5.8 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR 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@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 15:07:54 -0000 On Thu, Aug 05, 2021 at 02:31:02PM +0530, Prathamesh Kulkarni wrote: > On Wed, 4 Aug 2021 at 18:30, Richard Earnshaw > wrote: > > We don't want to have to resort to macros. Not least because at some > > point we want to replace the content of arm_neon.h with a single #pragma > > directive to remove all the parsing of the header that's needed. What's > > more, if we had a suitable pragma we'd stand a fighting chance of being > > able to extend support to other languages as well that don't use the > > pre-processor, such as Fortran or Ada (not that that is on the cards > > right now). > Hi, > IIUC, a more general issue here, is that the intrinsics require > special type-checking of arguments, beyond what is dictated by the > Standard. > An argument needing to be an ICE could be seen as one instance. > > So perhaps, should there be some mechanism to tell the FE to let the > target do additional checking for a particular function call, say by An integer constant expression can be checked by the frontend itself, it does not depend on optimisation etc. That is the beauty of it: it is a) more local, and b) a more reliable / less surprising thing to use. But it *is* less powerful than "it is a constant integer after a travel through the bowels of the compiler". Which of course is less reliable and more surprising (think what happens if you use -O0 or -O1 or -Og or -Os or any -fno- etc.) So it will be a lot more maintenance work (answering PRs about it is only the start). Segher