From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id CD261388A02B; Tue, 2 May 2023 20:14:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD261388A02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683058463; bh=8YkAtKoU27r0BpUXRPaHPrNc0vAtG3G5fDAjEMWham8=; h=From:To:Subject:Date:From; b=T3PWE9uSYa9iK/eKTfBYRmUX6x+QuQ5Zr/NO7+zBxOkLBMIrkyJUqcJOHUQkxBKpE HSD7sfRoXVie4qz6GvXdWnbbmseIZ09DRMLHLVkkHT+ftGnXjZ5W49ZfNh7OsEnXHf kewZLbvGOiv7dTyeARHnLPyciEGoKKRCk9XBVaMs= 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 r11-10708] 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/releases/gcc-11 X-Git-Oldrev: 8dbd2cd0729f928cbb0d71d0cebcc8891185d771 X-Git-Newrev: 658156714de37163d570ace3a868f23900b0efe9 Message-Id: <20230502201423.CD261388A02B@sourceware.org> Date: Tue, 2 May 2023 20:14:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:658156714de37163d570ace3a868f23900b0efe9 commit r11-10708-g658156714de37163d570ace3a868f23900b0efe9 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.c (gfc_trans_use_stmts): Call clear_slot before doing continue. (cherry picked from commit 76f7f0eddcb7c418d1ec3dea3e2341ca99097301) Diff: --- gcc/fortran/trans-decl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index f54b62b4fda..b4fc4afdda3 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5431,7 +5431,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)