From patchwork Sat Aug 17 12:00:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 96025 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4D38F386100A for ; Sat, 17 Aug 2024 12:00:51 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by sourceware.org (Postfix) with ESMTPS id 36CF43861831 for ; Sat, 17 Aug 2024 12:00:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 36CF43861831 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 36CF43861831 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::221 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; cv=none; b=e6mNCkSEaOwUQaecbTz6GdTFzoGw+bFWHQNSluc7R3oQy54hYq3xaX3PmydvKHkT1N3dzN5R7MvbNhMcHK5awJYsaeEWh82msUfRcH3Kk8kbNRMeFrz6U/NS0lHkh91/UOgs8nVqlSOylLAZEM1Aqe2VvxoBurlyrR/sTH8ls/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; c=relaxed/simple; bh=+6JcwVN0nbLoAk6hRmVxEYQbGNNSseTkAMRjp+tEqsU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=hiWZZH+8RK8sfvKVXuF9NfufPCCU2sHXR0o3E3X4JETpwEKoSkzDCgnFLm0jg44clD3cXk9JZ/MiYQwWI69btEVahiGTD884c7hEg/DmuQsDe850OrjJYYj7slzsClSweABwv89p1faKgrlsYdSkoWBwcV3O2zWBfnOaE6he0pU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 9E3AD240003; Sat, 17 Aug 2024 12:00:27 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id B219E507F1C8; Sat, 17 Aug 2024 14:00:26 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 1/4] ir: Improve legibility of set_member_function_is_virtual Date: Sat, 17 Aug 2024 14:00:23 +0200 Message-ID: <20240817120026.459568-1-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org * src/abg-ir.cc (set_member_function_is_virtual): Remove useless white space and use clearer helper function. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 542f9060..bc23254a 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -6730,8 +6730,7 @@ set_member_function_is_virtual(const function_decl_sptr& fn, bool is_virtual) if (fn) { set_member_function_is_virtual(*fn, is_virtual); - fixup_virtual_member_function - (dynamic_pointer_cast(fn)); + fixup_virtual_member_function(is_method_decl(fn)); } } From patchwork Sat Aug 17 12:00:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 96023 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16D203861833 for ; Sat, 17 Aug 2024 12:00:38 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by sourceware.org (Postfix) with ESMTPS id B53123861821 for ; Sat, 17 Aug 2024 12:00:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B53123861821 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B53123861821 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; cv=none; b=MK15cFDll6vtL+Bg3iIHAfK2zycZrdFrS4T8s1hUshdM79Ns0INaiyCAlGZve6wWH6l7VxCvZTGhBC5IUraiWQpjz4SzSH0r+1oa2Lo51t7LHLXIFq4+aC89+BXilQHKNrKFx6EhvRzprigDGTiq5GavEwSnR33FWH6rZO1pEu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; c=relaxed/simple; bh=MbykQyYZwTHtKI6JyokuXqSHapeNr1uKIPfyTHthoQ4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=BP/aUS698HCrwbUqQTkNKLOp27A8lP8VUM0PiRtsXN03621q+m2MoWvmC+rkDBhNHF2c6UQxVutGqT/tSsbzr7Vbr3yFSMd3QQg1ng2Ps6+BJVhjv40jBHukOjsBU7RkpfdKoLkVos7b5KEMUxVc43+80PTge/r0bQRVWleiRU8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 75053FF803; Sat, 17 Aug 2024 12:00:27 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id B3A92507F1C9; Sat, 17 Aug 2024 14:00:26 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 2/4] ir: Don't cache internal name of non-canonicalized function types Date: Sat, 17 Aug 2024 14:00:24 +0200 Message-ID: <20240817120026.459568-2-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240817120026.459568-1-dodji@redhat.com> References: <20240817120026.459568-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org When a function type is not yet canonicalized, do not cache its name, otherwise, the name can capture the state of the function in a too early state. * src/abg-ir.cc (function_type::get_cached_name): Do not cache internal name for non-canonicalized function types. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index bc23254a..873f3750 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -21633,9 +21633,8 @@ function_type::get_cached_name(bool internal) const } else { - if (priv_->temp_internal_cached_name_.empty()) - priv_->temp_internal_cached_name_ = - get_function_type_name(this, /*internal=*/true); + priv_->temp_internal_cached_name_ = + get_function_type_name(this, /*internal=*/true); return priv_->temp_internal_cached_name_; } } From patchwork Sat Aug 17 12:00:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 96024 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 76C973860C30 for ; Sat, 17 Aug 2024 12:00:45 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by sourceware.org (Postfix) with ESMTPS id CC6353860765 for ; Sat, 17 Aug 2024 12:00:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC6353860765 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC6353860765 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; cv=none; b=U4uTFm6fXaW/lLEAHSezODv/re/WEUsQYtVCnZqVMP0I/EHJRC73ZXf31Gw1ZR3TAnDYtnxSokYlCmYTYkDfvOrBz1bytgey9EydV/eEnhGoW7xn5cV+U5x0dBNAKNRfKQx5wmxD4GK8gC/oKCfBBkcytrjlqSLf9UYXL7fcJvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; c=relaxed/simple; bh=T61OgdzK9v+wCkzVB44W6RJq/PRT9aJFxTRwEPRgv9Y=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=L5Khb9znw02qyuNbKjZG2o292cp9Yv25/Fww4MKTSTXA4vZZr2KiDL6JuOty7VqmVzGwzqyu3ORsASuwUR70ziUeLOut3Emy3RAGOz2rn0rY4cRgrYFGRSQoRILEsbYOU3aAyjDebkvMKUOL7pELx3tTi8WqbYP5CHWVwrUauVc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id A6B8C1BF203; Sat, 17 Aug 2024 12:00:27 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id B59A4507F1CA; Sat, 17 Aug 2024 14:00:26 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 3/4] reader: Avoid empty return type node for a function type IR Date: Sat, 17 Aug 2024 14:00:25 +0200 Message-ID: <20240817120026.459568-3-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240817120026.459568-1-dodji@redhat.com> References: <20240817120026.459568-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org Sometimes, the function type IR can have an empty node as return type, to represent void. This can wreak havoc on some part of the code that don't expect that. This patch uses a proper void type node for that instead. * src/abg-reader.cc (build_function_type): If the return type node is empty, use a void type node. Signed-off-by: Dodji Seketeli --- src/abg-reader.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index 8c66d6b4..e9cc9f19 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -4515,11 +4515,16 @@ build_function_type(reader& rdr, if (xml_char_sptr s = xml::build_sptr(xmlGetProp(n, BAD_CAST("type-id")))) type_id = CHAR_STR(s); + type_base_sptr ret_type; if (!type_id.empty()) - fn_type->set_return_type(rdr.build_or_get_type_decl - (type_id, true)); + ret_type = rdr.build_or_get_type_decl (type_id, true); + if (!ret_type) + ret_type = return_type; + fn_type->set_return_type(ret_type); } } + if (!fn_type->get_return_type()) + fn_type->set_return_type(return_type); fn_type->set_parameters(parms); From patchwork Sat Aug 17 12:00:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 96026 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DCEFB3860C33 for ; Sat, 17 Aug 2024 12:01:24 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by sourceware.org (Postfix) with ESMTPS id 096523860C08 for ; Sat, 17 Aug 2024 12:00:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 096523860C08 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 096523860C08 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4b98:dc4:8::222 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; cv=none; b=qD4ckHXbXyST/poad1VxRMlfdq09+ewm5bBzuUyzwgnrxa0euX/04Bwqp9/a12DAsI5MVVBFg6jNMpPPVOoalg1CR4omno6jJ+BB6fBVWSxxAtkQ79qAC0Cv/UODNM9lVkLxWE8XIBhbLupY58ZzXOr28h7DOR5mcNHh3TYNEbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723896033; c=relaxed/simple; bh=b+38dszDVj7P9VaeNScHZieVJDZHz/KbiVo6FlhwepA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=UYfk2NHl2GeejbCBUPqDVXmgL08eqX89FY1FAtmtSAV/byMOZPc6FwqHZ65HxxEN8mLT4TKW59PySk2BZSTCL2CHaoQL+l9K+2O9TkY3cTK7cBv1t/T6Ej6xB87WxI7MdKX9wpHs4OsJ/sJT0VnvWSi0AqThQ8z3NXLtL0H7iLo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 76F9940005; Sat, 17 Aug 2024 12:00:27 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id B7BCE507F1CB; Sat, 17 Aug 2024 14:00:26 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Cc: dodji@redhat.com Subject: [PATCH 4/4] ir: Handle ptr to fn type member with empty void return type Date: Sat, 17 Aug 2024 14:00:26 +0200 Message-ID: <20240817120026.459568-4-dodji@redhat.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240817120026.459568-1-dodji@redhat.com> References: <20240817120026.459568-1-dodji@redhat.com> MIME-Version: 1.0 X-GND-Sasl: dodj@seketeli.org X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces~patchwork=sourceware.org@sourceware.org If a pointer to member type points to a function type that has an empty return type, sometimes that can lead to a crash. This patch considers that the empty return type is a void type. * src/abg-ir.cc (add_outer_ptr_to_mbr_type_expr): If the function type has no return type, consider it as void type. Signed-off-by: Dodji Seketeli --- src/abg-ir.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 873f3750..f189cb09 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -28903,6 +28903,7 @@ add_outer_ptr_to_mbr_type_expr(const ptr_to_mbr_type* p, return ""; std::ostringstream left, right, inner; + type_base_sptr void_type = p->get_environment().get_void_type(); string containing_type_name = get_type_name(p->get_containing_type(), qualified, internal); type_base_sptr mbr_type = p->get_member_type(); @@ -28913,6 +28914,8 @@ add_outer_ptr_to_mbr_type_expr(const ptr_to_mbr_type* p, stream_pretty_representation_of_fn_parms(*fn_type, right, qualified, internal); type_base_sptr return_type = fn_type->get_return_type(); + if (!return_type) + return_type = void_type; if (is_npaf_type(return_type) || !(is_pointer_to_function_type(return_type) || is_pointer_to_array_type(return_type)