From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 1A5503858D35 for ; Wed, 29 Sep 2021 07:13:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1A5503858D35 Received: by mail-ed1-x52a.google.com with SMTP id v18so4746632edc.11 for ; Wed, 29 Sep 2021 00:13:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=s/lWPJP8k/7rOIKxxY4VJ8QQMxH0/heZvQ10PXosJYA=; b=2kVEzodlV9EtWXistMB+kEuoogYxShAlEpsy+cgSHCWKdePOjy6RbjGXtdVYr6QjYs 7y7zcPRsZ5DLiDrHbWA9vLuv4tydKBzwwMOxOhTzKQfnzShn/SMCogzsV5j4P0kkGRE2 oO8Bv02A901cVFnQtuA4kYxEACEzrXq4bwViZf9XWivCwIP10QWiZIjWs7jWsee/H0/5 Hdyb1WYQj+wgN2VTcCqDdTRE2UWsi+Vxw1tO/n8JOF60iD4Fkv0q4Yzs225Ade7g2gea wW1It1TZAawKpSVi1/MKc8wAdDl2mT6kFbNuX+zAgAOl/9Gu/5hy0dNU1wSk5xkIOiSa oNAQ== X-Gm-Message-State: AOAM5335tbD1eUVONP5oowXDZDCfIrG3h46XquhNrMJwZeiUmmyY7Z+6 NyqCmGqw4cn433QayQE5Zsdyvf8I6pz5ypoFh8E= X-Google-Smtp-Source: ABdhPJztQ7cLncFF5wDKPjhkztIBWS9wjgKXuh80eQzaom7oB8dDiFQUfM6YV/AnHxPMnn4BXFJIWYIJgQ38ONaEFbY= X-Received: by 2002:a17:906:584:: with SMTP id 4mr12039349ejn.56.1632899629950; Wed, 29 Sep 2021 00:13:49 -0700 (PDT) MIME-Version: 1.0 References: <1632854443-6232-1-git-send-email-indu.bhagat@oracle.com> In-Reply-To: <1632854443-6232-1-git-send-email-indu.bhagat@oracle.com> From: Richard Biener Date: Wed, 29 Sep 2021 09:13:38 +0200 Message-ID: Subject: Re: [PATCH] debug/102507: ICE in btf_finalize when compiling with -gbtf To: Indu Bhagat Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Wed, 29 Sep 2021 07:13:53 -0000 On Tue, Sep 28, 2021 at 8:41 PM Indu Bhagat via Gcc-patches wrote: > > Fix the free'up of btf_var_ids hash_map in btf_finalize (). OK. > Testing notes: > > - Bootstrapped GCC with -gbtf as an experiment. > - Usual bootstrap and regression testing on x86_64. > - BPF backend testing - make all-gcc, reg tested bpf.exp, btf.exp and ctf.exp. > (tested using David Faust's config.gcc patch posted earlier > https://gcc.gnu.org/pipermail/gcc-patches/2021-September/580422.html) > > gcc/ChangeLog: > > PR debug/102507 > * btfout.c (GTY): Add GTY (()) albeit for cosmetic only purpose. > (btf_finalize): Empty the hash_map btf_var_ids. > --- > gcc/btfout.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gcc/btfout.c b/gcc/btfout.c > index cdc6c63..a787815 100644 > --- a/gcc/btfout.c > +++ b/gcc/btfout.c > @@ -70,7 +70,7 @@ static char btf_info_section_label[MAX_BTF_LABEL_BYTES]; > converted to BTF_KIND_VAR type records. Strictly accounts for the index > from the start of the variable type entries, does not include the number > of types emitted prior to the variable records. */ > -static hash_map *btf_var_ids; > +static GTY (()) hash_map *btf_var_ids; > > /* Mapping of type IDs from original CTF ID to BTF ID. Types do not map > 1-to-1 from CTF to BTF. To avoid polluting the CTF container when updating > @@ -1119,12 +1119,12 @@ btf_finalize (void) > > funcs = NULL; > > + btf_var_ids->empty (); > + btf_var_ids = NULL; > + > free (btf_id_map); > btf_id_map = NULL; > > - ggc_free (btf_var_ids); > - btf_var_ids = NULL; > - > ctf_container_ref tu_ctfc = ctf_get_tu_ctfc (); > ctfc_delete_container (tu_ctfc); > tu_ctfc = NULL; > -- > 1.8.3.1 >