aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-02-03 21:37:27 +0100
committerJakub Jelinek <jakub@redhat.com>2023-05-03 14:36:09 +0200
commit072b2cdb620767c283f1329e95c7d4d35686596e (patch)
treed228b80060120106cd67adb62f4db91b2e902451 /gcc/fortran
parent837723e0543d74663f05e1c000f7ea32e38ded5e (diff)
downloadgcc-072b2cdb620767c283f1329e95c7d4d35686596e.zip
gcc-072b2cdb620767c283f1329e95c7d4d35686596e.tar.gz
gcc-072b2cdb620767c283f1329e95c7d4d35686596e.tar.bz2
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 <jakub@redhat.com> PR fortran/108451 * trans-decl.c (gfc_trans_use_stmts): Call clear_slot before doing continue. (cherry picked from commit 76f7f0eddcb7c418d1ec3dea3e2341ca99097301)
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/trans-decl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index b616db3..897928a 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -5408,7 +5408,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)