RESOLVED FIXED 43841
SegmentedVector::operator== typo
https://bugs.webkit.org/show_bug.cgi?id=43841
Summary SegmentedVector::operator== typo
andreyf
Reported 2010-08-11 03:02:13 PDT
WTF::SegmentedVector::operator== (in file webkit\JavaScriptCore\wtf\SegmentedVector.h:70) has typo: bool operator==(const Iterator& other) const { return (m_index == other.m_index && m_segment = other.m_segment && &m_vector == &other.m_vector); // HERE: m_segment _=_ other.m_segment } This should be: bool operator==(const Iterator& other) const { return (m_index == other.m_index && m_segment == other.m_segment && &m_vector == &other.m_vector); } Because normaly operator== should be ! operator!=. bool operator!=(const Iterator& other) const { return (m_index != other.m_index || m_segment != other.m_segment || &m_vector != &other.m_vector); // NOTE: m_segment _!=_ other.m_segment } I don't know consequences of this. Kind regards, Andrey
Attachments
Darin Adler
Comment 1 2010-08-11 08:58:23 PDT
Looks bad! I wonder what the symptom is.
Geoffrey Garen
Comment 2 2010-08-11 10:10:17 PDT
It looks like the operator isn't used. I'd suggest removing it.
andreyf
Comment 3 2010-08-12 00:27:04 PDT
(In reply to comment #1) > Looks bad! I wonder what the symptom is. Darin, unfortunately, this was found by my code intrumentation utility and i don't have time to compose a unit test to reproduce erroneous behaviour. I promise to try later. Why don't change this to something like: bool operator==(const Iterator& other) const { return ! operator!= (other); } It will not consume much code space and provide full external interface to SegmentedVector. Kind regards, Andrey
Geoffrey Garen
Comment 4 2010-08-12 11:37:55 PDT
I'm not keen on having unused / untested code in the tree. It leads to bitrot like this. If you plan on using this function, that's a different story.
Darin Adler
Comment 5 2010-08-12 12:22:38 PDT
Yes, lets remove the function as Geoff suggests.
Gavin Barraclough
Comment 6 2011-06-14 18:58:08 PDT
Fixed in r88892. (These operators are used by the DFG JIT).
Gavin Barraclough
Comment 7 2011-08-12 16:10:45 PDT
*** Bug 56289 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.