NEW 226167
GCC complains about a memcpy in SmallSet.h
https://bugs.webkit.org/show_bug.cgi?id=226167
Summary GCC complains about a memcpy in SmallSet.h
Eleni Maria Stea
Reported 2021-05-24 00:57:16 PDT
GCC complains about a memcpy in SmallSet.h It seems that it contains an object with no trivial copy-assignment. We'd rather eplace the memcpy with assignments of the private members. Error: WTF/Headers/wtf/SmallSet.h:70:15: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class WTF::SmallSet<WTF::UniquedStringImpl*’ with no trivial copy-assignment [-Wclass-memaccess] 70 | memcpy(this, &other, sizeof(SmallSet)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WTF/Headers/wtf/SmallSet.h:44:7: note: ‘class WTF::SmallSet<WTF::UniquedStringImpl*>’ declared here 44 | class SmallSet {
Attachments
Patch (1.26 KB, patch)
2021-05-24 01:01 PDT, Eleni Maria Stea
mcatanzaro: review+
mcatanzaro: commit-queue-
Eleni Maria Stea
Comment 1 2021-05-24 01:01:53 PDT
Radar WebKit Bug Importer
Comment 2 2021-05-31 00:58:16 PDT
Michael Catanzaro
Comment 3 2023-11-14 10:58:23 PST
Comment on attachment 429512 [details] Patch Found this when searching for -Wclass-memaccess warnings. It will need to be rebased because I added void casts at some point to suppress this warning. Your solution is better.
Darin Adler
Comment 4 2023-11-15 07:43:49 PST
Comment on attachment 429512 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429512&action=review > Source/WTF/wtf/SmallSet.h:72 > + this->m_size = other.m_size; > + this->m_capacity = other.m_capacity; > + this->m_inline = other.m_inline; We can also omit the "this->" here.
Note You need to log in before you can comment on or make changes to this bug.