On 10/17/24 6:04 PM, Patrick Palka wrote:
Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look
OK for trunk?

OK, thanks.

-- >8 --

After r15-4050-g5dad738c1dd164 register_specialization needs to set
elt.hash to the (maybe) precomputed hash in order to avoid redundantly
rehashing.

gcc/cp/ChangeLog:

        * pt.cc (register_specialization): Set elt.hash.
---
  gcc/cp/pt.cc | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 8b183a139d7..ec4313090bd 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -1545,9 +1545,7 @@ register_specialization (tree spec, tree tmpl, tree args, 
bool is_friend,
    elt.tmpl = tmpl;
    elt.args = args;
    elt.spec = spec;
-
-  if (hash == 0)
-    hash = spec_hasher::hash (&elt);
+  elt.hash = hash;
spec_entry **slot = decl_specializations->find_slot (&elt, INSERT);
    if (*slot)

Reply via email to