From patchwork Fri Aug 25 16:33:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 136927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp1918199vqm; Fri, 25 Aug 2023 09:34:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM4gS95d98yjtQ4h7gSXVcDEQZt5W+ApuvBHBzLQm0dA7xABe2lXWdI5g6JRaI81PGOcjg X-Received: by 2002:aa7:d741:0:b0:522:ab06:7213 with SMTP id a1-20020aa7d741000000b00522ab067213mr14009584eds.27.1692981266355; Fri, 25 Aug 2023 09:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692981266; cv=none; d=google.com; s=arc-20160816; b=qH1sWmXPj1QRjcCXGyqpgoD1FUD+ZKgLRso0DXvLZLg/dcfLyp3rXjbwXmkKWP/q1h 9fhK80129G5yk3gKTuFcmSLXcGqx2zjPIDbgxYsfzeYUbN7ukj6n3Z8aS1R0ajRN0C0K D1x4Vnyp47IZwWu5f8mQXVO8Dq1wUsc/2fab9Z/7kJFbRpodfg2bknz/Nr+WwPCZVzCX K9TQKmjkpTLMrmNVzTQs4uclFDWnN8u0bXGxKMCIwmIdUxXsv2dT0fIKNEv7DZ9FNGet Av51IuyT5MHWzPUTSy9PGYmYKQmUoMDqJE7rNYi1aOZKiHDV+Kwfgredc6x1jV4fe0+b 35mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=eZ0MOHhDiVheRrycthMxGtYttL3kZ54V8KYR5Xp83Gw=; fh=1Hi9m88IqcWZGtfSxUrMGG+GBgL26N02X1SANXM6iTs=; b=H8cESIZwcG8NDbWlUBdL90j2ZhhvHWmmM4hZ1mGCpr/Xu/nwC5unJwEonMA4l7jQZW q5RVb+NRuwIOa509YmglLuPyCmR1nCEW5wHAWtZDujjuBI3DCrv4C4GizKg738mgkmwA WiEAUy85SpF1ky1S4WL9RhbXc0QUtT9GunqEA1CyXfo2Q//XbwXGeeGgqSIpO7UZBmFp rWdx0xVImVYUVOB0amANmTUxlqm+a8AE/8vVlz2Q9dNqUh9EmjePt7fghM6UqGbBOS6y uOQ1t5OwETgwsa1PWsGPJWSH4FKDSEWkNuQmWQmgnCode2AgqEv1XmSsv+mdEkDRLmMP ypdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lWzBC3py; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g2-20020aa7c582000000b005257d3c91easi1346726edq.313.2023.08.25.09.34.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 09:34:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lWzBC3py; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 95BFF385802F for ; Fri, 25 Aug 2023 16:34:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95BFF385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692981264; bh=eZ0MOHhDiVheRrycthMxGtYttL3kZ54V8KYR5Xp83Gw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=lWzBC3pyN1bTzcSHxexZCymU9KRTiktqOEM6l9PtpF0EXUF7/OPYKzsb6zSVKRPzB CsbIjXJw40OrjrFGRP0EY061/kRtCgGN4e/2IOf0WsLjypALbHAcPoS+rUOdp+GdB2 YWoT2upsHg6O3Hea0AuBWpJ6bq9MqjO4q6rWm9L4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A03873858C53 for ; Fri, 25 Aug 2023 16:33:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A03873858C53 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-wIJAAssVNeWxkT72jdb3Ug-1; Fri, 25 Aug 2023 12:33:35 -0400 X-MC-Unique: wIJAAssVNeWxkT72jdb3Ug-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-76dcf1d8905so124317785a.1 for ; Fri, 25 Aug 2023 09:33:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692981215; x=1693586015; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eZ0MOHhDiVheRrycthMxGtYttL3kZ54V8KYR5Xp83Gw=; b=Kx8gpolS9qMCYAzjFI5IPAzkCViJjGilTRpFtSR+6AcSPTgiVDLyJDYYcYbSJcQFQe rQYG85Nt6MIKnwReBQEDOslqMQQwYWQoW7mSWtQ2kYXqp5KNE4CPRfOTqtRiiISmjgHX YgrQLG0KtLNIeKj1g578hTUSdeFHR2TUNV3wpVujwFNbE8pmVzWAy7LV5Nb74H9INFup QpBqGIjjrcfuMOBdjLHxaf0RT0jvuBQXBRkQL18aRNpGk81a5mwHJ35vs7weOsMAlQ7c go67RQXbHuPWJJ0XvqIzOS8DCUrwsytSA1irklKzSFgOeZWRc8V9kOGbv4i/T6jZ+xHZ lCUA== X-Gm-Message-State: AOJu0YyoFHdaiZjLtu7dW8J5hCM6MmbJsGFf+JhFE3xfc77fVBSsJRmA /T8MGIreXxtCCKdmIPC5/6Ci3+FAw6TABPwLxCIBBP59wQwhItnBLDxdIdrfgJY2LHovf6yXOtn /uUe5/BETct7Cy+ZXLJh8VCofW7fZ1VdMBJwhc2oXRwEQcJpimBgdF/dcCO//U9+cF4tm0mR+LU k= X-Received: by 2002:a05:620a:4084:b0:76c:bfeb:97d0 with SMTP id f4-20020a05620a408400b0076cbfeb97d0mr23768360qko.58.1692981214723; Fri, 25 Aug 2023 09:33:34 -0700 (PDT) X-Received: by 2002:a05:620a:4084:b0:76c:bfeb:97d0 with SMTP id f4-20020a05620a408400b0076cbfeb97d0mr23768327qko.58.1692981214193; Fri, 25 Aug 2023 09:33:34 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id q19-20020ae9e413000000b00767d8e12ce3sm482135qkc.49.2023.08.25.09.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 09:33:33 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, Patrick Palka Subject: [PATCH] c++: use conversion_obstack_sentinel throughout Date: Fri, 25 Aug 2023 12:33:31 -0400 Message-ID: <20230825163331.3231278-1-ppalka@redhat.com> X-Mailer: git-send-email 2.42.0.29.gcd9da15a85 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775219524232649075 X-GMAIL-MSGID: 1775219524232649075 Boostrapped and regtested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- This replaces manual memory management via conversion_obstack_alloc(0) and obstack_free with the recently added conversion_obstack_sentinel, and also uses the latter in build_user_type_conversion and build_operator_new_call. gcc/cp/ChangeLog: * call.cc (build_user_type_conversion): Free allocated conversions. (build_converted_constant_expr_internal): Use conversion_obstack_sentinel instead. (perform_dguide_overload_resolution): Likewise. (build_new_function_call): Likewise. (build_operator_new_call): Free allocated conversions. (build_op_call): Use conversion_obstack_sentinel instead. (build_conditional_expr): Use conversion_obstack_sentinel instead, and hoist it out to the outermost scope. (build_new_op): Use conversion_obstack_sentinel instead and set it up before the first goto. Remove second unneeded goto. (build_op_subscript): Use conversion_obstack_sentinel instead. (ref_conv_binds_to_temporary): Likewise. (build_new_method_call): Likewise. (can_convert_arg): Likewise. (can_convert_arg_bad): Likewise. (perform_implicit_conversion_flags): Likewise. (perform_direct_initialization_if_possible): Likewise. (initialize_reference): Likewise. --- gcc/cp/call.cc | 107 ++++++++++--------------------------------------- 1 file changed, 22 insertions(+), 85 deletions(-) diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 673ec91d60e..432ac99b4bb 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -4646,6 +4646,9 @@ build_user_type_conversion (tree totype, tree expr, int flags, tree ret; auto_cond_timevar tv (TV_OVERLOAD); + + conversion_obstack_sentinel cos; + cand = build_user_type_conversion_1 (totype, expr, flags, complain); if (cand) @@ -4698,15 +4701,13 @@ build_converted_constant_expr_internal (tree type, tree expr, int flags, tsubst_flags_t complain) { conversion *conv; - void *p; tree t; location_t loc = cp_expr_loc_or_input_loc (expr); if (error_operand_p (expr)) return error_mark_node; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; conv = implicit_conversion (type, TREE_TYPE (expr), expr, /*c_cast_p=*/false, flags, complain); @@ -4815,9 +4816,6 @@ build_converted_constant_expr_internal (tree type, tree expr, expr = error_mark_node; } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return expr; } @@ -4985,8 +4983,7 @@ perform_dguide_overload_resolution (tree dguides, const vec *args, gcc_assert (deduction_guide_p (OVL_FIRST (dguides))); - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - void *p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; z_candidate *cand = perform_overload_resolution (dguides, args, &candidates, &any_viable_p, complain); @@ -4999,9 +4996,6 @@ perform_dguide_overload_resolution (tree dguides, const vec *args, else result = cand->fn; - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return result; } @@ -5015,7 +5009,6 @@ build_new_function_call (tree fn, vec **args, { struct z_candidate *candidates, *cand; bool any_viable_p; - void *p; tree result; if (args != NULL && *args != NULL) @@ -5028,8 +5021,7 @@ build_new_function_call (tree fn, vec **args, if (flag_tm) tm_malloc_replacement (fn); - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; cand = perform_overload_resolution (fn, *args, &candidates, &any_viable_p, complain); @@ -5061,9 +5053,6 @@ build_new_function_call (tree fn, vec **args, == BUILT_IN_NORMAL) result = coro_validate_builtin_call (result); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return result; } @@ -5108,6 +5097,8 @@ build_operator_new_call (tree fnname, vec **args, if (*args == NULL) return error_mark_node; + conversion_obstack_sentinel cos; + /* Based on: [expr.new] @@ -5234,7 +5225,6 @@ build_op_call (tree obj, vec **args, tsubst_flags_t complain) tree fns, convs, first_mem_arg = NULL_TREE; bool any_viable_p; tree result = NULL_TREE; - void *p; auto_cond_timevar tv (TV_OVERLOAD); @@ -5273,8 +5263,7 @@ build_op_call (tree obj, vec **args, tsubst_flags_t complain) return error_mark_node; } - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; if (fns) { @@ -5377,9 +5366,6 @@ build_op_call (tree obj, vec **args, tsubst_flags_t complain) } } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return result; } @@ -5587,7 +5573,6 @@ build_conditional_expr (const op_location_t &loc, bool is_glvalue = true; struct z_candidate *candidates = 0; struct z_candidate *cand; - void *p; tree orig_arg2, orig_arg3; auto_cond_timevar tv (TV_OVERLOAD); @@ -5631,6 +5616,8 @@ build_conditional_expr (const op_location_t &loc, || error_operand_p (arg3)) return error_mark_node; + conversion_obstack_sentinel cos; + orig_arg2 = arg2; orig_arg3 = arg3; @@ -5911,9 +5898,6 @@ build_conditional_expr (const op_location_t &loc, conversion *conv3; bool converted = false; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); - conv2 = conditional_conversion (arg2, arg3, complain); conv3 = conditional_conversion (arg3, arg2, complain); @@ -5969,9 +5953,6 @@ build_conditional_expr (const op_location_t &loc, converted = true; } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - if (result) return result; @@ -6961,7 +6942,6 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags, enum tree_code code2 = ERROR_MARK; enum tree_code code_orig_arg1 = ERROR_MARK; enum tree_code code_orig_arg2 = ERROR_MARK; - void *p; bool strict_p; bool any_viable_p; @@ -6972,6 +6952,8 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags, || error_operand_p (arg3)) return error_mark_node; + conversion_obstack_sentinel cos; + bool ismodop = code == MODIFY_EXPR; if (ismodop) { @@ -7042,13 +7024,10 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags, if (arg3 != NULL_TREE) arglist->quick_push (arg3); - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); - result = add_operator_candidates (&candidates, code, code2, arglist, lookups, flags, complain); if (result == error_mark_node) - goto user_defined_result_ready; + return error_mark_node; switch (code) { @@ -7343,11 +7322,6 @@ build_new_op (const op_location_t &loc, enum tree_code code, int flags, } } - user_defined_result_ready: - - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - if (result || result_valid_p) return result; @@ -7443,7 +7417,6 @@ build_op_subscript (const op_location_t &loc, tree obj, tree fns, first_mem_arg = NULL_TREE; bool any_viable_p; tree result = NULL_TREE; - void *p; auto_cond_timevar tv (TV_OVERLOAD); @@ -7473,8 +7446,7 @@ build_op_subscript (const op_location_t &loc, tree obj, return error_mark_node; } - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; if (fns) { @@ -7542,9 +7514,6 @@ build_op_subscript (const op_location_t &loc, tree obj, gcc_unreachable (); } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return result; } @@ -9687,8 +9656,7 @@ ref_conv_binds_to_temporary (tree type, tree expr, bool direct_init_p/*=false*/) { gcc_assert (TYPE_REF_P (type)); - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - void *p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; const int flags = direct_init_p ? LOOKUP_NORMAL : LOOKUP_IMPLICIT; conversion *conv = implicit_conversion (type, TREE_TYPE (expr), expr, @@ -9697,9 +9665,6 @@ ref_conv_binds_to_temporary (tree type, tree expr, bool direct_init_p/*=false*/) if (conv && !conv->bad_p) ret = tristate (conv_binds_ref_to_temporary (conv)); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return ret; } @@ -11423,7 +11388,6 @@ build_new_method_call (tree instance, tree fns, vec **args, tree orig_instance; tree orig_fns; vec *orig_args = NULL; - void *p; auto_cond_timevar tv (TV_OVERLOAD); @@ -11550,8 +11514,7 @@ build_new_method_call (tree instance, tree fns, vec **args, else first_mem_arg = maybe_resolve_dummy (instance, false); - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; /* The number of arguments artificial parms in ARGS; we subtract one because there's no 'this' in ARGS. */ @@ -11816,9 +11779,6 @@ skip_prune: call = build_nop (void_type_node, call); } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - if (orig_args != NULL) release_tree_vector (orig_args); @@ -13335,11 +13295,9 @@ can_convert_arg (tree to, tree from, tree arg, int flags, tsubst_flags_t complain) { conversion *t; - void *p; bool ok_p; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; /* We want to discard any access checks done for this test, as we might not be in the appropriate access context and we'll do the check again when we actually perform the @@ -13352,8 +13310,6 @@ can_convert_arg (tree to, tree from, tree arg, int flags, /* Discard the access checks now. */ pop_deferring_access_checks (); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); return ok_p; } @@ -13365,15 +13321,11 @@ can_convert_arg_bad (tree to, tree from, tree arg, int flags, tsubst_flags_t complain) { conversion *t; - void *p; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; /* Try to perform the conversion. */ t = implicit_conversion (to, from, arg, /*c_cast_p=*/false, flags, complain); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); return t != NULL; } @@ -13408,7 +13360,6 @@ perform_implicit_conversion_flags (tree type, tree expr, tsubst_flags_t complain, int flags) { conversion *conv; - void *p; location_t loc = cp_expr_loc_or_input_loc (expr); if (TYPE_REF_P (type)) @@ -13419,8 +13370,7 @@ perform_implicit_conversion_flags (tree type, tree expr, if (error_operand_p (expr)) return error_mark_node; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; conv = implicit_conversion (type, TREE_TYPE (expr), expr, /*c_cast_p=*/false, @@ -13441,9 +13391,6 @@ perform_implicit_conversion_flags (tree type, tree expr, expr = convert_like (conv, expr, complain); } - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return expr; } @@ -13469,7 +13416,6 @@ perform_direct_initialization_if_possible (tree type, tsubst_flags_t complain) { conversion *conv; - void *p; if (type == error_mark_node || error_operand_p (expr)) return error_mark_node; @@ -13496,8 +13442,7 @@ perform_direct_initialization_if_possible (tree type, return build_cplus_new (type, expr, complain); } - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; conv = implicit_conversion (type, TREE_TYPE (expr), expr, c_cast_p, @@ -13519,9 +13464,6 @@ perform_direct_initialization_if_possible (tree type, /*issue_conversion_warnings=*/false, c_cast_p, /*nested_p=*/false, complain); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return expr; } @@ -13760,14 +13702,12 @@ initialize_reference (tree type, tree expr, int flags, tsubst_flags_t complain) { conversion *conv; - void *p; location_t loc = cp_expr_loc_or_input_loc (expr); if (type == error_mark_node || error_operand_p (expr)) return error_mark_node; - /* Get the high-water mark for the CONVERSION_OBSTACK. */ - p = conversion_obstack_alloc (0); + conversion_obstack_sentinel cos; conv = reference_binding (type, TREE_TYPE (expr), expr, /*c_cast_p=*/false, flags, complain); @@ -13814,9 +13754,6 @@ initialize_reference (tree type, tree expr, else gcc_unreachable (); - /* Free all the conversions we allocated. */ - obstack_free (&conversion_obstack, p); - return expr; }