public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/7057: Operator== on hashtables doesn't appear to work correctly (patch included)
@ 2002-06-17 10:57 steev
  0 siblings, 0 replies; 3+ messages in thread
From: steev @ 2002-06-17 10:57 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7057
>Category:       libstdc++
>Synopsis:       Operator== on hashtables doesn't appear to work correctly (patch included)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 17 09:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Steev Wilcox
>Release:        3.1
>Organization:
>Environment:
Solaris 8
>Description:
The operator== on hashtables in stl_hashtable.h compares the two tables for exact equivalence - the list in each bin must have the same entries in the same order.  This will generally fail, because the keys in a hashtable aren't ordered by definition, so the lists are in an effectively random order.  The equality operator on x==y needs to check each element in x's list for being in y's list, and also check that there are the same number of elements in each (that's necessary and sufficient).

I've included a patch for this, in file stl_hashtable_h_diff in archive gccbug3.tar.gz.  There's also a C++ file hashtest.cpp which shows the comparison failing under the library shipped with GCC 3.1, and shows it working with this patch.  The software that we're developing also works with this patch applied.  I can't post this patch directly, because (1) I don't have time to exhaustively it, although we've done some testing, and (2) my mail server is blocked from posting to GCC mailing lists. :-(

Please email me if the attachment doesn't get added by the web page.

Regards and thanks, Steev
>How-To-Repeat:
Create two hash-tables, one in the reverse order of the other, but with the same data.  Sometimes the == operator works on these, sometimes it doesn't.  File hashtest.cpp in the attached .tar.gz file shows this with 10 string->int hashmaps of 10 entries each.
>Fix:
Apply stl_hashtable_h_diff to ext/stl_hashtable.h
It's just an algorithm change.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-gzip-compressed; name="gccbug3.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gccbug3.tar.gz"

H4sIAFERDj0AA+1XS2/jNhDOtQb8H2a3aCL5KS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f69u1cjUL/iTJIHhHpSFc
us7g0nNAWtYntb6ig4Cp41oOZviMhDsK3gfLPNxQwUdSzbJld4gK2B/qoy74kK5oD9XDPHPRwUO7
a9T+5D+h7Gll77Hym/omA790fXpa2pUjd7hA0zuSyFNbzZUSv7rgimVrcpUZw88+aDKpzOWMXdnv
D+W1g1eEdvT5s9av1fQxviZ4C6jFD80eGTuqQnwAKKqhyMT5FHA8/P4zMR7DLxENN8DxxwgklN2I
CNI1JDEX/AvZeuVM9MsAPqR/4w8iGUTK6BnH65pui96LZBRbChARhRQfmTYp4jn+Lato/WfjsrW3
vX6D2rDBOs3ZqjJqcS2X/m8JKm3qr+v5R75lqb5vGNaf8/n9ZDf0961FH4SiCr2psMSfz5um6FCN
61HRfzVdNRd8KqOH43vstS8QAwMDAwMDAwMDAwMDAwMDAwMDAwOD7xL/AtOHzpMAKAAA


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/7057: Operator== on hashtables doesn't appear to work correctly (patch included)
@ 2002-07-04  9:59 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2002-07-04  9:59 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, steev

Synopsis: Operator== on hashtables doesn't appear to work correctly (patch included)

State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Thu Jul  4 09:59:50 2002
State-Changed-Why:
    Fix in.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7057


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/7057: Operator== on hashtables doesn't appear to work correctly (patch included)
@ 2002-07-03 17:50 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2002-07-03 17:50 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, nobody, steev

Synopsis: Operator== on hashtables doesn't appear to work correctly (patch included)

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Wed Jul  3 17:50:07 2002
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Wed Jul  3 17:50:07 2002
State-Changed-Why:
    This is in now, thanks!
    
    -benjamin

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7057


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-04 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-17 10:57 libstdc++/7057: Operator== on hashtables doesn't appear to work correctly (patch included) steev
2002-07-03 17:50 bkoz
2002-07-04  9:59 bkoz

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).