From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E8C481581EE for ; Tue, 01 Apr 2025 14:46:11 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id D36B3343113 for ; Tue, 01 Apr 2025 14:46:11 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 27F611102CD; Tue, 01 Apr 2025 14:46:09 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 1839A1102CD for ; Tue, 01 Apr 2025 14:46:09 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B108334302F for ; Tue, 01 Apr 2025 14:46:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DEC6D181E for ; Tue, 01 Apr 2025 14:46:06 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1743518708.5a9abe3487663d97c3b2bc1bc5d6b5e59de514fe.sam@gentoo> Subject: [gentoo-commits] proj/gcc-patches:master commit in: 15.0.0/gentoo/ X-VCS-Repository: proj/gcc-patches X-VCS-Files: 15.0.0/gentoo/81_all_PR119383-missing-lifetime-extension.patch 15.0.0/gentoo/README.history X-VCS-Directories: 15.0.0/gentoo/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 5a9abe3487663d97c3b2bc1bc5d6b5e59de514fe X-VCS-Branch: master Date: Tue, 01 Apr 2025 14:46:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7d8e5902-fcea-4e76-b74e-2eba872d8f02 X-Archives-Hash: 221c903131bc5d12688ab5a96b2e1254 commit: 5a9abe3487663d97c3b2bc1bc5d6b5e59de514fe Author: Sam James gentoo org> AuthorDate: Tue Apr 1 14:45:08 2025 +0000 Commit: Sam James gentoo org> CommitDate: Tue Apr 1 14:45:08 2025 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=5a9abe34 15.0.0: drop lifetime extension patch Merged upstream. Signed-off-by: Sam James gentoo.org> ...1_all_PR119383-missing-lifetime-extension.patch | 168 --------------------- 15.0.0/gentoo/README.history | 1 - 2 files changed, 169 deletions(-) diff --git a/15.0.0/gentoo/81_all_PR119383-missing-lifetime-extension.patch b/15.0.0/gentoo/81_all_PR119383-missing-lifetime-extension.patch deleted file mode 100644 index 42eed3f..0000000 --- a/15.0.0/gentoo/81_all_PR119383-missing-lifetime-extension.patch +++ /dev/null @@ -1,168 +0,0 @@ -https://inbox.sourceware.org/gcc-patches/Z-sCHDjucrcWTs2f@redhat.com/ - -From d1ddf83b25fbe6c7c247007c754b7858cfaea916 Mon Sep 17 00:00:00 2001 -Message-ID: -From: Marek Polacek -Date: Mon, 31 Mar 2025 16:59:08 -0400 -Subject: [PATCH] c++: fix missing lifetime extension [PR119383] - -Since r15-8011 cp_build_indirect_ref_1 won't do the *&TARGET_EXPR -> -TARGET_EXPR folding not to change its value category. That fix seems -correct but it made us stop extending the lifetime in this testcase, -causing a wrong-code issue -- extend_ref_init_temps_1 did not see -through the extra *& because it doesn't use a tree walk. - -This patch reverts r15-8011 and instead handles the problem in -build_over_call by calling force_lvalue in the is_really_empty_class -case as well as in the general case. - - PR c++/119383 - -gcc/cp/ChangeLog: - - * call.cc (build_over_call): Use force_lvalue to ensure op= returns - an lvalue. - * cp-tree.h (force_lvalue): Declare. - * cvt.cc (force_lvalue): New. - * typeck.cc (cp_build_indirect_ref_1): Revert r15-8011. - -gcc/testsuite/ChangeLog: - -* g++.dg/cpp0x/temp-extend3.C: New test. ---- - gcc/cp/call.cc | 9 ++++--- - gcc/cp/cp-tree.h | 1 + - gcc/cp/cvt.cc | 13 +++++++++ - gcc/cp/typeck.cc | 10 +++---- - gcc/testsuite/g++.dg/cpp0x/temp-extend3.C | 32 +++++++++++++++++++++++ - 5 files changed, 55 insertions(+), 10 deletions(-) - create mode 100644 gcc/testsuite/g++.dg/cpp0x/temp-extend3.C - -diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc -index c1c8987ec8b1..b1469cb5a4c9 100644 ---- a/gcc/cp/call.cc -+++ b/gcc/cp/call.cc -@@ -10828,10 +10828,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) - if (is_really_empty_class (type, /*ignore_vptr*/true)) - { - /* Avoid copying empty classes, but ensure op= returns an lvalue even -- if the object argument isn't one. This isn't needed in other cases -- since MODIFY_EXPR is always considered an lvalue. */ -- to = cp_build_addr_expr (to, tf_none); -- to = cp_build_indirect_ref (input_location, to, RO_ARROW, complain); -+ if the object argument isn't one. */ -+ to = force_lvalue (to, complain); - val = build2 (COMPOUND_EXPR, type, arg, to); - suppress_warning (val, OPT_Wunused); - } -@@ -10852,6 +10850,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) - tree array_type, alias_set; - - arg2 = TYPE_SIZE_UNIT (as_base); -+ /* Ensure op= returns an lvalue even if the object argument isn't -+ one. */ -+ to = force_lvalue (to, complain); - to = cp_stabilize_reference (to); - arg0 = cp_build_addr_expr (to, complain); - -diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h -index 2f2122dcf241..927f51b116b3 100644 ---- a/gcc/cp/cp-tree.h -+++ b/gcc/cp/cp-tree.h -@@ -7079,6 +7079,7 @@ extern tree convert_to_reference (tree, tree, int, int, tree, - tsubst_flags_t); - extern tree convert_from_reference (tree); - extern tree force_rvalue (tree, tsubst_flags_t); -+extern tree force_lvalue (tree, tsubst_flags_t); - extern tree ocp_convert (tree, tree, int, int, - tsubst_flags_t); - extern tree cp_convert (tree, tree, tsubst_flags_t); -diff --git a/gcc/cp/cvt.cc b/gcc/cp/cvt.cc -index bd1f147f2c56..f663a6d08c89 100644 ---- a/gcc/cp/cvt.cc -+++ b/gcc/cp/cvt.cc -@@ -575,6 +575,19 @@ force_rvalue (tree expr, tsubst_flags_t complain) - return expr; - } - -+/* Force EXPR to be an lvalue, if it isn't already. */ -+ -+tree -+force_lvalue (tree expr, tsubst_flags_t complain) -+{ -+ if (!lvalue_p (expr)) -+ { -+ expr = cp_build_addr_expr (expr, complain); -+ expr = cp_build_indirect_ref (input_location, expr, RO_ARROW, complain); -+ } -+ return expr; -+} -+ - - /* If EXPR and ORIG are INTEGER_CSTs, return a version of EXPR that has - TREE_OVERFLOW set only if it is set in ORIG. Otherwise, return EXPR -diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc -index c8e4441fb8b4..4f4dc683b5a0 100644 ---- a/gcc/cp/typeck.cc -+++ b/gcc/cp/typeck.cc -@@ -3870,13 +3870,11 @@ cp_build_indirect_ref_1 (location_t loc, tree ptr, ref_operator errorstring, - return error_mark_node; - } - else if (do_fold && TREE_CODE (pointer) == ADDR_EXPR -- && same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0))) -- /* Don't let this change the value category. '*&TARGET_EXPR' -- is an lvalue, but folding it into 'TARGET_EXPR' would turn -- it into a prvalue of class type. */ -- && lvalue_p (TREE_OPERAND (pointer, 0))) -+ && same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0)))) - /* The POINTER was something like `&x'. We simplify `*&x' to -- `x'. */ -+ `x'. This change the value category: '*&TARGET_EXPR' -+ is an lvalue and folding it into 'TARGET_EXPR' turns it into -+ a prvalue of class type. */ - return TREE_OPERAND (pointer, 0); - else - { -diff --git a/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C b/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C -new file mode 100644 -index 000000000000..3eab88d0076e ---- /dev/null -+++ b/gcc/testsuite/g++.dg/cpp0x/temp-extend3.C -@@ -0,0 +1,32 @@ -+// PR c++/119383 -+// { dg-do run { target c++11 } } -+ -+int g; -+ -+struct base { -+ virtual base *clone() const = 0; -+ ~base() { } -+}; -+ -+struct impl : virtual base { -+ base *clone() const { return new impl; } // #1 -+ impl() { ++g; } -+ ~impl() { --g; } -+}; -+ -+const base * -+make_a_clone () -+{ -+ const base &base = impl{}; // #2 -+ return base.clone(); -+} -+ -+int -+main () -+{ -+ make_a_clone (); -+ // impl::impl() is called twice (#1 and #2), impl::~impl() once, -+ // at the end of make_a_clone. -+ if (g != 1) -+ __builtin_abort (); -+} - -base-commit: aa3aaf2bfb8fcc17076993df4297597b68bc5f60 --- -2.49.0 - diff --git a/15.0.0/gentoo/README.history b/15.0.0/gentoo/README.history index 0a6f844..7e0990c 100644 --- a/15.0.0/gentoo/README.history +++ b/15.0.0/gentoo/README.history @@ -1,6 +1,5 @@ 51 ???? - + 81_all_PR119383-missing-lifetime-extension.patch + 82_all_PR119318-ipa-cp.patch 50 31 March 2025