From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 3355238582A3; Fri, 23 Dec 2022 07:30:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3355238582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671780657; bh=F1D2BBf0hy4Vtt1dp4BNd1uz452e4GSGlirtycGYUJs=; h=From:To:Subject:Date:From; b=Dy9fnbQw84NL2SSzuA6PWOK0/AfIh9epTW8lX6aMDGWVqA+m6bGTLG3665yhANVUo /8q4DZZd3Vx5astEEkWF3mmUNTXR/luuqN5KGjVqSqX0f1BpGdaNmCZ1LP7bx6EluZ hNBECRgF3KndXDePyjoi4cPnKQyJRacmf4SBHRkQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] check hash table counts X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: 40b8ac12dfce49a956bcd61f3d53f779dec2c630 X-Git-Newrev: c09625cbca67cab516571ebc45162fd0ec0f4c6f Message-Id: <20221223073057.3355238582A3@sourceware.org> Date: Fri, 23 Dec 2022 07:30:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c09625cbca67cab516571ebc45162fd0ec0f4c6f commit c09625cbca67cab516571ebc45162fd0ec0f4c6f Author: Alexandre Oliva Date: Thu Dec 22 21:28:45 2022 -0300 check hash table counts Diff: --- gcc/hash-table.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 53507daae26..7dbeea05373 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -1035,6 +1035,23 @@ hash_table && Descriptor::equal (*entry, comparable)) hashtab_chk_error (); } + + if (m_size < 2048) + { + size_t elmts = m_n_elements, dels = m_n_deleted; + for (size_t i = 0; i < m_size; i++) + { + value_type *entry = &m_entries[i]; + if (!is_empty (*entry)) + { + elmts--; + if (is_deleted (*entry)) + dels--; + } + } + if (elmts || dels) + hashtab_chk_error (); + } } /* This function deletes an element with the given COMPARABLE value