From patchwork Mon Apr 8 09:49:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1920756 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=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ybQ20xcm; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=bEamV5Rv; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ybQ20xcm; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=bEamV5Rv; 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 4VCkp35jVGz1yYT for ; Mon, 8 Apr 2024 19:49:30 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BE3C8385841F for ; Mon, 8 Apr 2024 09:49:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 29C413858D20 for ; Mon, 8 Apr 2024 09:49:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 29C413858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 29C413858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712569744; cv=none; b=kswNU3Q4gKhzkSjLyr3B2aToOsCzh60N4cK3O4ZJS5h/naQcfBgsJjN8IwmCFJe7BiHJCcbAk9l4L1IRtf0aohMvwrjMcENnYgbtIA9CyxMizplHpKBdzQzncJukmdgKOfqU0bNO181OvWnjDlNF2OvvZcWy37Duf0r2xSCXsyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712569744; c=relaxed/simple; bh=THW7Blf94k85uIhKkfUf7c9dFY39Ra8aDjURBXP4ciY=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=i9xhCrQB0kl0KsjLl4N9wt/QB4koVjKU27AEs+u0vrUyzrQ8q8k+oO3d8UxA9/xOb+J3HknyQRLy9F6wbO74X0FdmDjmz4QRVLNXUlz4tL2ldF0Z6NajyrNGn19k/bcGDUvTZzyMqQNuwKd+BmqPlDK/TJsKPpmjpCuqrlt+3rc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.5.241] (unknown [10.168.5.241]) (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-out1.suse.de (Postfix) with ESMTPS id 046AB22729; Mon, 8 Apr 2024 09:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712569742; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=LvgSasZDEiBX9gOz/r83wMyS45/pYk+ulN8vJVUWwmY=; b=ybQ20xcmygSE+pEicDFBXCUOFbGzfVswH6oamAwOGabtmU5CG0Stk9wN0OZHKtzBwnm6tF RLm5R9bMyJqBN2vOceT1ypqb/LFyBbejnqBYd89DnvFG1QZOgIiSD6RDpsRgPtbSc4Xcwv Cm9ds5qMROlMe+3It50cJOZ5PpSeGv4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712569742; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=LvgSasZDEiBX9gOz/r83wMyS45/pYk+ulN8vJVUWwmY=; b=bEamV5RvfD1kmyMjCO+dUxLnL23KU8l7XxHzZa2sIjc/0FC+hRdhaf0obXy0jjIEef5c0q 8pb4vWB+z52juwAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712569742; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=LvgSasZDEiBX9gOz/r83wMyS45/pYk+ulN8vJVUWwmY=; b=ybQ20xcmygSE+pEicDFBXCUOFbGzfVswH6oamAwOGabtmU5CG0Stk9wN0OZHKtzBwnm6tF RLm5R9bMyJqBN2vOceT1ypqb/LFyBbejnqBYd89DnvFG1QZOgIiSD6RDpsRgPtbSc4Xcwv Cm9ds5qMROlMe+3It50cJOZ5PpSeGv4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712569742; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=LvgSasZDEiBX9gOz/r83wMyS45/pYk+ulN8vJVUWwmY=; b=bEamV5RvfD1kmyMjCO+dUxLnL23KU8l7XxHzZa2sIjc/0FC+hRdhaf0obXy0jjIEef5c0q 8pb4vWB+z52juwAA== Date: Mon, 8 Apr 2024 11:49:01 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek , amacleod@redhat.com Subject: [PATCH] middle-end/114604 - ranger allocates bitmap without initialized obstack MIME-Version: 1.0 X-Spam-Score: 1.20 X-Spamd-Result: default: False [1.20 / 50.00]; MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.19)[-0.952]; MIME_GOOD(-0.10)[text/plain]; BAYES_HAM(-0.01)[45.65%]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; TO_DN_SOME(0.00)[] X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, 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 Message-Id: <20240408094928.BE3C8385841F@sourceware.org> The following fixes ranger bitmap allocation when invoked from IPA context where the global bitmap obstack possibly isn't initialized. Instead of trying to use one of the ranger obstacks the following simply initializes the global bitmap obstack around an active ranger. Bootstrapped and tested on x86_64-unknown-linux-gnu with bitmap_alloc instrumentation (all ICEs gone, so ranger was the only offender). OK? Thanks, Richard. PR middle-end/114604 * gimple-range.cc (enable_ranger): Initialize the global bitmap obstack. (disable_ranger): Release it. --- gcc/gimple-range.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index c16b776c1e3..4d3b1ce8588 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -689,6 +689,8 @@ enable_ranger (struct function *fun, bool use_imm_uses) { gimple_ranger *r; + bitmap_obstack_initialize (NULL); + gcc_checking_assert (!fun->x_range_query); r = new gimple_ranger (use_imm_uses); fun->x_range_query = r; @@ -705,6 +707,8 @@ disable_ranger (struct function *fun) gcc_checking_assert (fun->x_range_query); delete fun->x_range_query; fun->x_range_query = NULL; + + bitmap_obstack_release (NULL); } // ------------------------------------------------------------------------