From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8546C2D0A3 for ; Mon, 9 Nov 2020 19:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 603062067B for ; Mon, 9 Nov 2020 19:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729493AbgKITq1 (ORCPT ); Mon, 9 Nov 2020 14:46:27 -0500 Received: from gate.crashing.org ([63.228.1.57]:52883 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729336AbgKITq0 (ORCPT ); Mon, 9 Nov 2020 14:46:26 -0500 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 Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org 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