From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id BAF1A3858C50 for ; Tue, 27 Feb 2024 03:13:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BAF1A3858C50 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BAF1A3858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709003585; cv=none; b=HProJJdQGvhSJ2pHTXrA9UMEAOqSFEk74XV/pYhHrRhT8h2KsPz4Zrh0/L9UcdM6kVTyVEbjyAx5CbwmfvN2I9xxudNJMbCdn5jHWnioAyEGoMdoF86vaCyegJFmSaKLfVPJiEl6lnE7hWNifTUSoBvmp9IeTUDngqR10GcPRng= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709003585; c=relaxed/simple; bh=22kj/qdLwf+zUiZCEKeD1LqhoCtiPVJCD/p1w2g3IvY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=cxt30HrzHlPcyidJqo/8JFXyEZyYaFYTEB5uaEZgBb2BkGlgVrmDlT9BoKPC1ePzhw4iERyRs3vMeYNVBwBH4hPG4jgsnjf1xpwfrmjwjVi6KOvBF8aLnXoTwk0qVTG4Y7et0QpGZWIAGottm26GXHe9EyM4gwg3M1qt6uA3Azs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5009a.ext.cloudfilter.net ([10.0.29.176]) by cmsmtp with ESMTPS id en7krYldquh6sentur6yGU; Tue, 27 Feb 2024 03:13:02 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id enttr8E7Kk4fsenttrq2p7; Tue, 27 Feb 2024 03:13:02 +0000 X-Authority-Analysis: v=2.4 cv=eZw7faEH c=1 sm=1 tr=0 ts=65dd533e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=zstS-IiYAAAA:8 a=20KFwNOVAAAA:8 a=aafxSZypWaQ67KQJpqUA:9 a=QEXdDO2ut3YA:10 a=4G6NA9xxw8l3yy4pmD5M:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=HJP6g1mfg2FLkKj6IQSXqOzbN5iLPCRrxXDWcqBQvVg=; b=r7OySzonsCIaR7ZzMFdwAdnN8V mXodrS6Rf75/CRLuPU3nMncoCwR6yQUb9dJhli79bXhycA9dagsanZcpjk/QkX7rhtIVkGAH8OX5r DYw5M/CcUUvBKKc0zM3GkSXAF; Received: from 71-211-170-195.hlrn.qwest.net ([71.211.170.195]:51654 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rentt-004JgU-12 for gcc-patches@gcc.gnu.org; Mon, 26 Feb 2024 20:13:01 -0700 From: Tom Tromey Date: Mon, 26 Feb 2024 20:12:54 -0700 Subject: [PATCH 1/3] Change 'v1' float and int code to fall back to v0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240226-gdb-compile-align-v1-1-0f95d6435299@tromey.com> References: <20240226-gdb-compile-align-v1-0-0f95d6435299@tromey.com> In-Reply-To: <20240226-gdb-compile-align-v1-0-0f95d6435299@tromey.com> To: gcc-patches@gcc.gnu.org X-Mailer: b4 0.12.4 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.170.195 X-Source-L: No X-Exim-ID: 1rentt-004JgU-12 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-170-195.hlrn.qwest.net ([192.168.0.21]) [71.211.170.195]:51654 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHEhSEEPMJQIKAbhNu2AlY3S2szMue1AhozhcV9NOSydgphTENY4yDYI3McC7sCzRzPOaNZsm1vJ8jxyVu6OaZ3wOBrw3OAVqt7WMWvGIP+wq9TB3Ig/ kBZPBCY5RIPOSsGHdcP6jHiaAZtqGGoU3Vcrq8Ku2CfR8dPjjlMx3/kFaEnGhSaxTPvtQKx/pNoXl6o0cPwBnNlYgbJ0nzyRFes= X-Spam-Status: No, score=-3022.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: While working on another patch, I discovered that the libcc1 plugin code never did version negotiation correctly. So, the patches to introduce v1 never did anything -- the new code, as far as I know, has never been run. Making version negotiation work shows that the existing code causes crashes. For example, safe_lookup_builtin_type might return error_mark_node in some cases, which the callers aren't prepared to accept. Looking into it some more, I couldn't find any justification for this v1 code for the C compiler plugin. Since it's not run at all, it's also clear that removing it doesn't cause any regressions in gdb. However, rather than remove it, this patch changes it to handle ERROR_MARK better, and then to fall back to the v0 code if the new code fails to find the type it's looking for. 2024-02-26 Tom Tromey * libcc1plugin.cc (safe_lookup_builtin_type): Handle ERROR_MARK. (plugin_int_type): Fall back to plugin_int_type_v0. (plugin_float_type): Fall back to plugin_float_type_v0. --- libcc1/ChangeLog | 6 ++++++ libcc1/libcc1plugin.cc | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libcc1/ChangeLog b/libcc1/ChangeLog index f81fe389e71..b0b31ee6586 100644 --- a/libcc1/ChangeLog +++ b/libcc1/ChangeLog @@ -1,3 +1,9 @@ +2024-02-26 Tom Tromey + + * libcc1plugin.cc (safe_lookup_builtin_type): Handle ERROR_MARK. + (plugin_int_type): Fall back to plugin_int_type_v0. + (plugin_float_type): Fall back to plugin_float_type_v0. + 2024-02-09 Marek Polacek PR c++/98388 diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc index 00d3963029d..f1082d8e9d3 100644 --- a/libcc1/libcc1plugin.cc +++ b/libcc1/libcc1plugin.cc @@ -555,7 +555,7 @@ safe_lookup_builtin_type (const char *builtin_name) gcc_assert (TREE_CODE (result) == TYPE_DECL); result = TREE_TYPE (result); - return result; + return TREE_CODE (result) == ERROR_MARK ? nullptr : result; } static gcc_type @@ -592,13 +592,14 @@ plugin_int_type (cc1_plugin::connection *self, int is_unsigned, unsigned long size_in_bytes, const char *builtin_name) { - if (!builtin_name) - return plugin_int_type_v0 (self, is_unsigned, size_in_bytes); - - tree result = safe_lookup_builtin_type (builtin_name); - gcc_assert (!result || TREE_CODE (result) == INTEGER_TYPE); - - return plugin_int_check (self, is_unsigned, size_in_bytes, result); + if (builtin_name != nullptr) + { + tree result = safe_lookup_builtin_type (builtin_name); + gcc_assert (!result || TREE_CODE (result) == INTEGER_TYPE); + if (result != nullptr) + return plugin_int_check (self, is_unsigned, size_in_bytes, result); + } + return plugin_int_type_v0 (self, is_unsigned, size_in_bytes); } gcc_type @@ -631,7 +632,7 @@ plugin_float_type (cc1_plugin::connection *self, tree result = safe_lookup_builtin_type (builtin_name); if (!result) - return convert_out (error_mark_node); + return plugin_float_type_v0 (self, size_in_bytes); gcc_assert (SCALAR_FLOAT_TYPE_P (result)); gcc_assert (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (result)); -- 2.43.0