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 C16913857C65 for ; Mon, 9 Nov 2020 19:42:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C16913857C65 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@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 0A9JcrKT019444; Mon, 9 Nov 2020 13:38:53 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 0A9JcpYj019443; Mon, 9 Nov 2020 13:38:51 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 9 Nov 2020 13:38:51 -0600 From: Segher Boessenkool To: Peter Zijlstra Cc: Uros Bizjak , GCC Development , X86 ML , Jakub Jelinek , Andy Lutomirski , linux-toolchains@vger.kernel.org, borntraeger@de.ibm.com, Will Deacon , Linus Torvalds , mpe@ellerman.id.au Subject: Re: typeof and operands in named address spaces Message-ID: <20201109193851.GI2672@gate.crashing.org> References: <20201109124713.GP2594@hirez.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201109124713.GP2594@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-6.5 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 09 Nov 2020 19:42:12 -0000 On Mon, Nov 09, 2020 at 01:47:13PM +0100, Peter Zijlstra wrote: > > + lots of people and linux-toolchains > > On Wed, Nov 04, 2020 at 07:31:42PM +0100, Uros Bizjak wrote: > > Hello! > > > > I was looking at the recent linux patch series [1] where segment > > qualifiers (named address spaces) were introduced to handle percpu > > variables. In the patch [2], the author mentions that: > > > > --q-- > > Unfortunately, gcc does not provide a way to remove segment > > qualifiers, which is needed to use typeof() to create local instances > > of the per-cpu variable. For this reason, do not use the segment > > qualifier for per-cpu variables, and do casting using the segment > > qualifier instead. > > --/q-- > > C in general does not provide means to strip qualifiers. Most ways you can try to use the result are undefined behaviour, even. > We recently had > a _lot_ of 'fun' trying to strip volatile from a type, see here: > > https://lore.kernel.org/lkml/875zimp0ay.fsf@mpe.ellerman.id.au > > which resulted in the current __unqual_scalar_typeof() hack. > > If we're going to do compiler extentions here, can we pretty please have > a sane means of modifying qualifiers in general? What do you want to do with it? It may be more feasible to do a compiler extension for *that*. Segher