public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-5697] fortran: Fix up hash table usage in gfc_trans_use_stmts [PR108451]
Date: Fri,  3 Feb 2023 20:38:48 +0000 (GMT)	[thread overview]
Message-ID: <20230203203848.125FD3858C5F@sourceware.org> (raw)

https://gcc.gnu.org/g:76f7f0eddcb7c418d1ec3dea3e2341ca99097301

commit r13-5697-g76f7f0eddcb7c418d1ec3dea3e2341ca99097301
Author: Jakub Jelinek <jakub@redhat.com>
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  <jakub@redhat.com>
    
            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)

                 reply	other threads:[~2023-02-03 20:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230203203848.125FD3858C5F@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).