From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 2036E3858D32 for ; Thu, 10 Aug 2023 22:27:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2036E3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.01,163,1684828800"; d="scan'208";a="14152008" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 10 Aug 2023 14:27:26 -0800 IronPort-SDR: PpJiy/dyiyzPpH7CPfR/rztqcdZk2kW78K6L2UAqglRTmrdmewKwzVQc/S2WE8PhUHGux8WwX2 IAivvBb2Ys/COVpCgeha4N9GLdyP3fR7e6jOQWfJnUszkZJDNuoNvSDUgAAnEuID1tgSt1PlJ0 soJI3lycvxHcDHKvxwRdQ7MeSkNO8jQluNEkU9ne/VQQndzPhG3hVqR/H7R6ZGdcV8nXD+hHJl Jr8XheZ4vu9Jt3OTR8JlrTTn1V/87+FG4HMh7d/y5dTbbRElBytTcLQArVxdBK78Yko4m4KVw0 p6M= Date: Thu, 10 Aug 2023 22:27:21 +0000 From: Joseph Myers To: Jason Merrill CC: Jakub Jelinek , Marek Polacek , Subject: Re: [PATCH] c, c++, v2: Accept __builtin_classify_type (typename) In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3104.9 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP 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, 10 Aug 2023, Jason Merrill via Gcc-patches wrote: > On 8/10/23 11:35, Jakub Jelinek wrote: > > Hi! > > > > I'd like to ping this patch. Reposting it as I found a typo in the > > documentation - s/builtin-in/built-in/. Bootstrapped/regtested again > > on x86_64-linux and i686-linux, ok for trunk? > > > > On Mon, Jun 12, 2023 at 09:57:17PM +0200, Jakub Jelinek via Gcc-patches > > wrote: > > > As mentioned in my stdckdint.h mail, __builtin_classify_type has > > > a problem that argument promotion (the argument is passed to ... > > > prototyped builtin function) means that certain type classes will > > > simply never appear. > > > I think it is too late to change how it behaves, lots of code in the > > > wild might rely on the current behavior. > > Hmm, you really think there's any code at all in the wild relying on > __builtin_classify_type + array/function decay? It's a (previously) > undocumented built-in, I wouldn't expect anyone outside the project to be > using it. So at first glance I'd be inclined to fix it whether or not we also > allow it to accept a type. But I don't actually know how it's used, so could > well be wrong... I don't know about array / function decay, but it seems quite plausible that code checking for pointers expects those to occur. Certainly glibc's tgmath.h has code expecting booleans to be treated like other integers (i.e. subject to integer promotions because passed in ...) by __builtin_classify_type (though you'd need a fairly old glibc version to use that implementation of the tgmath.h macros with current GCC rather than one based on __builtin_tgmath). -- Joseph S. Myers joseph@codesourcery.com