From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 AA7FF3858410 for ; Mon, 8 Apr 2024 15:40:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AA7FF3858410 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 AA7FF3858410 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=1712590840; cv=none; b=caICHqbmSOVTCpQcgIYmgr2WP1ZW2zqvHCpIbPHBRVnOLJkxVRue3CwmWQu8rHWh1NB7GpJS4CX32Vx4gULglJXqUWqa07u3jNpjOQPJeh5cirGF3BO0DsX/FcAfoWMZU+2QzCUxIxM6pt67nqwDBauKpDD5cAXkYazLWqGRnac= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712590840; c=relaxed/simple; bh=0fDqEXNlKbS08jnOet9R/3DDVogsdncZW9WIzZ3nCFI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=kOqloIqgyWQ9jbWyS2GALHYeaZq4auom9vL/CUAN/giiHRdupfQlsxMSNmm4YWjc4rKuQlHOagqNEmJpgErU2gzHwCF0bvuUlr+Oc4LEBCDPkKIGIU0SAcsGMe6mTxA77f0ardIE83yszE6IEMuF40e7HjYkUazmzZtYkeoP9y4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712590838; 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: in-reply-to:in-reply-to:references:references; bh=BA6sSCsWUKecGh3J6YMhULxO1a/chhNH7VPBJ8nb9kA=; b=UApJTWHaQ2n9smcb0XXTn+G6Qud/L2+AoOpcerrmMVC+WiZA695HjFkvQX5Pp40ffg7HJx UoS32/L9YIiFpXS1/AFc64ToGyAIGgVQyqAZbF40VyS6emrd+XTxs81KbuIcvaTEPUX1ag 35uJhO8B5+MNRMEef/b1EhlmebiM0iY= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-T6jcU_JCN3ODpJlgDQFSbw-1; Mon, 08 Apr 2024 11:40:36 -0400 X-MC-Unique: T6jcU_JCN3ODpJlgDQFSbw-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-515af96a73bso3016143e87.2 for ; Mon, 08 Apr 2024 08:40:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712590834; x=1713195634; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BA6sSCsWUKecGh3J6YMhULxO1a/chhNH7VPBJ8nb9kA=; b=VNEKt4ub/8QEv0IAtKhGNtrEU1zyeC4zQixU88qTyozjYc7t2D5s8XRPPEej6p3pAe XDs4ZwXlhGM/WxPeRa94rnqhQq6t5B+AVLEV+ksa0wYQpno/a61YuMBNTyHL3q+N4YDV KKBcP2/HmQSrbkSSP884ZYJ9WlSlPkNO34tpw8SUKrgaLku8fT7fJaLHQOAbMvcWR/kF AlCkkAXxiyLByEHHeqDuvReUN3rYe+unISJRt/wx20+l4duw3iW+WLV0N/VaDkAZY4EJ SNB+QW/cotSBVmBQg4/eefTDC+uKi4PDnNQjsrtdEJueuZES3qKdx0YC28L+srIkzS9+ 9JFw== X-Gm-Message-State: AOJu0Yx29Sbv2GmI8oIf39UKtxTT5Ejx3PpQQnOhfWb+HGPewetSYt6F z+UDH7G6IuWQHG56fJYQobtEcOa7BeS8ptAz9JMa7ZwJoDyY9IbEbGZ4ErSb+A4kjU34NJ3iSjf foOdcYTqcFY0lC9W2TFCsSiXr0Hgujp02CbQ6+BTYFI5cuonApjcyzzv+o1FHH7jqFdxDFoW1RF kmDUeNiRxX8DHmlNK9QsCTUVPRJiWsHg== X-Received: by 2002:a05:6512:b8e:b0:513:c53b:4697 with SMTP id b14-20020a0565120b8e00b00513c53b4697mr7023790lfv.66.1712590834567; Mon, 08 Apr 2024 08:40:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzTZoAnPZE0r58cDsORKbeL1ySpQWzW3kE2I9qByt18cd8hYM6gWABiHneoyx2hR7gEYwmvS+qo0IZPcT5Vc4= X-Received: by 2002:a05:6512:b8e:b0:513:c53b:4697 with SMTP id b14-20020a0565120b8e00b00513c53b4697mr7023772lfv.66.1712590834162; Mon, 08 Apr 2024 08:40:34 -0700 (PDT) MIME-Version: 1.0 References: <20240408095018.4853D385841E@sourceware.org> In-Reply-To: <20240408095018.4853D385841E@sourceware.org> From: Aldy Hernandez Date: Mon, 8 Apr 2024 17:40:23 +0200 Message-ID: Subject: Re: [PATCH] middle-end/114604 - ranger allocates bitmap without initialized obstack To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , amacleod@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.1 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 List-Id: On Mon, Apr 8, 2024 at 11:50=E2=80=AFAM Richard Biener = wrote: > > 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_use= s) > { > gimple_ranger *r; > > + bitmap_obstack_initialize (NULL); > + > gcc_checking_assert (!fun->x_range_query); > r =3D new gimple_ranger (use_imm_uses); > fun->x_range_query =3D 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 =3D NULL; > + > + bitmap_obstack_release (NULL); Are you not allowed to initialize/use obstacks unless bitmap_obstack_initialize(NULL) is called? If so, wouldn't it be better to lazily initialize it downstream (bitmap_alloc, or whomever needs it initialized)? Unless I'm misunderstanding something, it doesn't seem like ranger is the correct place to fix this. Aldy