From patchwork Tue Oct 29 12:35:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 2003724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MjdGFtgZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xd8rL23VHz1xwc for ; Tue, 29 Oct 2024 23:36:14 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0CF3385841E for ; Tue, 29 Oct 2024 12:36:12 +0000 (GMT) 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 ESMTP id 396363858C98 for ; Tue, 29 Oct 2024 12:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 396363858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 396363858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730205351; cv=none; b=hvLCG6OGfBWjraNjvmQGoyDm8J1Nipd4w6y1K2a1M8oZVqwW9liuz7WptLLSH40qnLNkl7B3NFdnwn0/tON093nvImUXO//clpJAbczZUoz4qJMFzs2OIHg/qPh6JjvFgtqzr6GmXc1DwgDeZO5qwzCBbhqspBrmO+cnvYp+1R0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730205351; c=relaxed/simple; bh=zoGkpgHQH3Aq/jG9IkSJe89y/7ol791oxg9j7tpWGfc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=sGqw2NSC5UfxWkTglz/ni/4cSTWvZbHEFFv/F8ytLIbhZDdrEQBK4dGUI7Z+sgY3YBf0hzLtDrv5IO1mFRjQmXZZKs7Wp+YJzb+5Ym1xGm6RPGx/xrQKZs1Xd9k73KP/bNIsDADjaASmP0b4m6QXfhZQe8k0xum9e9f2hTuDTqM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730205347; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qvtoX6wvbzzAO1dTV3loIWG9swlwlp9sY7YT6vNwKzw=; b=MjdGFtgZsV2AU8K558SJycdHZQjrScONFmn92u5DGPBEiz8O1gunRg3cwofxlw+SsF3xbq SWQG3CgbDbF5201dp7jcgag9ioW3sTLPfShxmqYgXGxapirRuE6BwxESfGSamW6/ZsR2uQ pbrZxkjh6O42bJ+/2EdiEB6GrGVWgk8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-xPkCmVxOOD65n-DpPJsQow-1; Tue, 29 Oct 2024 08:35:45 -0400 X-MC-Unique: xPkCmVxOOD65n-DpPJsQow-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9895F1956080 for ; Tue, 29 Oct 2024 12:35:44 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.88.51]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C2E2E300018D; Tue, 29 Oct 2024 12:35:42 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed: r15-4739] jit: fix leak of pending_assemble_externals_set [PR117275] Date: Tue, 29 Oct 2024 08:35:39 -0400 Message-ID: <20241029123539.2082268-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 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_H3, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org My recent r15-4580-g779c0390e3b57d fix for resetting state in varasm.cc introduced some noise to "make selftest-valgrind" and, presumably, a memory leak in libgccjit: ==2462086== 160 (56 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 248 of 352 ==2462086== at 0x5270E7D: operator new(unsigned long) (vg_replace_malloc.c:342) ==2462086== by 0x1D1EB89: init_varasm_once() (varasm.cc:6806) ==2462086== by 0x181C845: backend_init() (toplev.cc:1826) ==2462086== by 0x181D41A: do_compile() (toplev.cc:2193) ==2462086== by 0x181D99C: toplev::main(int, char**) (toplev.cc:2371) ==2462086== by 0x378391D: main (main.cc:39) Fixed thusly. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Tested lightly on powerpc64le-unknown-linux-gnu. Pushed to trunk as r15-4739-g7f41203f08b994. gcc/ChangeLog: PR jit/117275 * varasm.cc (process_pending_assemble_externals): Reset pending_assemble_externals_set to nullptr after deleting it. (varasm_cc_finalize): Delete pending_assemble_externals_set. Signed-off-by: David Malcolm --- gcc/varasm.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/varasm.cc b/gcc/varasm.cc index ce1077b6d4bd..deefbac5b7b2 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -2575,6 +2575,7 @@ process_pending_assemble_externals (void) pending_assemble_externals_processed = true; pending_libcall_symbols = NULL_RTX; delete pending_assemble_externals_set; + pending_assemble_externals_set = nullptr; #endif } @@ -8893,6 +8894,7 @@ varasm_cc_finalize () #ifdef ASM_OUTPUT_EXTERNAL pending_assemble_externals_processed = false; + delete pending_assemble_externals_set; pending_assemble_externals_set = nullptr; #endif