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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 AC950C4741F for ; Mon, 9 Nov 2020 12:49:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4037C20789 for ; Mon, 9 Nov 2020 12:49:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="p8/XOfmP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbgKIMtr (ORCPT ); Mon, 9 Nov 2020 07:49:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729672AbgKIMrk (ORCPT ); Mon, 9 Nov 2020 07:47:40 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D71C0613CF for ; Mon, 9 Nov 2020 04:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=MrryuyH/97XScW4BosJAS4zwAeo7tTC3xuL85liT79w=; b=p8/XOfmP/L72zjcLWmn1pZ29ts kpGpy6Mpd+ol+SzElP7jMWvZjy5ubcDiTOKtLSP08eVDelZ+ygu/DckNP2gXnLbh4moyjSwFlSf+f 5xRn+HoQXC/M62HQ36Yy0RHjVHQpkJRW4wgZYwaaUz/1K+IgtBYEBb4H47XaLVYnYam/Tzkz8uy0H SKV/XCAWHEjTBCQFR2xt+sx4LC/zUyUM4Tjeck/kRVpuNOO94ufUJbZeJka98wyrybJv8AL0jMbpM CB3nucSNMmLrNV0mfuhIJUHKOgC4KhXCDCzACP/QLmxGyXWAjjtbnHBxMQfK4aw96kvQ13mk9zd1q oEYNiNyQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc6Zo-0002bN-5m; Mon, 09 Nov 2020 12:47:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A200F304D58; Mon, 9 Nov 2020 13:47:13 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 83D42203E223C; Mon, 9 Nov 2020 13:47:13 +0100 (CET) Date: Mon, 9 Nov 2020 13:47:13 +0100 From: Peter Zijlstra To: Uros Bizjak Cc: GCC Development , X86 ML , Jakub Jelinek , Andy Lutomirski , linux-toolchains@vger.kernel.org, segher@kernel.crashing.org, borntraeger@de.ibm.com, Will Deacon , Linus Torvalds , mpe@ellerman.id.au Subject: Re: typeof and operands in named address spaces Message-ID: <20201109124713.GP2594@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org + 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. 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?