From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 125FD3858C5F; Fri, 3 Feb 2023 20:38:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 125FD3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675456728; bh=rdYKifiOTPRniABjcE5yHJv+5cVk93ijttXXLfymQ1s=; h=From:To:Subject:Date:From; b=sLsOo5jauLcjmZl613VBsUvqJCAndZ3uVmsNTGkH16pMutH88Et+e8ZiMcN6ucstx YnOqziuJK5r5XUp5Xy3cIM6q8YbT2iCWZp2t0GJrxQPemvtp+5HmHtiTFwRUa8VWbS QoftH4ImPdEQdwCLtipUxLe9J0txJsE3GBCHW+WA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5697] fortran: Fix up hash table usage in gfc_trans_use_stmts [PR108451] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: e261fcefb71e1270673f0457fcc73711f13d3079 X-Git-Newrev: 76f7f0eddcb7c418d1ec3dea3e2341ca99097301 Message-Id: <20230203203848.125FD3858C5F@sourceware.org> Date: Fri, 3 Feb 2023 20:38:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:76f7f0eddcb7c418d1ec3dea3e2341ca99097301 commit r13-5697-g76f7f0eddcb7c418d1ec3dea3e2341ca99097301 Author: Jakub Jelinek Date: Fri Feb 3 21:37:27 2023 +0100 fortran: Fix up hash table usage in gfc_trans_use_stmts [PR108451] The first testcase in the PR (which I haven't included in the patch because it is unclear to me if it is supposed to be valid or not) ICEs since extra hash table checking has been added recently. The problem is that gfc_trans_use_stmts does tree *slot = entry->decls->find_slot_with_hash (rent->use_name, hash, INSERT); if (*slot == NULL) and later on doesn't store anything into *slot and continues. Another spot a few lines later correctly clears the slot if it decides not to use the slot, so the following patch does the same. 2023-02-03 Jakub Jelinek PR fortran/108451 * trans-decl.cc (gfc_trans_use_stmts): Call clear_slot before doing continue. Diff: --- gcc/fortran/trans-decl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 633300708f4..7a077801919 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -5350,7 +5350,11 @@ gfc_trans_use_stmts (gfc_namespace * ns) /* Sometimes, generic interfaces wind up being over-ruled by a local symbol (see PR41062). */ if (!st->n.sym->attr.use_assoc) - continue; + { + *slot = error_mark_node; + entry->decls->clear_slot (slot); + continue; + } if (st->n.sym->backend_decl && DECL_P (st->n.sym->backend_decl)