RESOLVED FIXED Bug 233720
Add static_assert the value we use to initialize a StructureID buffer should be 0.
https://bugs.webkit.org/show_bug.cgi?id=233720
Summary Add static_assert the value we use to initialize a StructureID buffer should ...
Keith Miller
Reported 2021-12-01 13:23:23 PST
Fix GCC warning about memcpy into a StructureID* buffer
Attachments
Patch (2.74 KB, patch)
2021-12-01 13:24 PST, Keith Miller
no flags
Patch for landing (2.70 KB, patch)
2021-12-01 13:32 PST, Keith Miller
no flags
Keith Miller
Comment 1 2021-12-01 13:24:00 PST
Yusuke Suzuki
Comment 2 2021-12-01 13:26:16 PST
Comment on attachment 445606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445606&action=review > Source/JavaScriptCore/runtime/StructureChain.cpp:52 > + static_assert(!StructureID().bits(), "Make sure the value we're going to memcpy below matches the default StructureID"); This part looks good. > Source/JavaScriptCore/runtime/StructureID.h:55 > + constexpr uint32_t bits() const { return m_bits; } Nice.
Keith Miller
Comment 3 2021-12-01 13:32:47 PST
Created attachment 445607 [details] Patch for landing
Michael Catanzaro
Comment 4 2021-12-01 13:45:21 PST
Comment on attachment 445607 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=445607&action=review > Source/JavaScriptCore/runtime/StructureChain.cpp:53 > memset(vector, 0, bytes); I'm skeptical that would be enough to suppress this warning. We'll probably need to do: memset(static_cast<void*>(vector), 0, bytes); If your patch alone isn't enough, I'll just commit this as a follow-up.
Keith Miller
Comment 5 2021-12-01 13:46:17 PST
(In reply to Michael Catanzaro from comment #4) > Comment on attachment 445607 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=445607&action=review > > > Source/JavaScriptCore/runtime/StructureChain.cpp:53 > > memset(vector, 0, bytes); > > I'm skeptical that would be enough to suppress this warning. We'll probably > need to do: > > memset(static_cast<void*>(vector), 0, bytes); > > If your patch alone isn't enough, I'll just commit this as a follow-up. Oh, this is just the static_assert now since Yusuke already landed a cast change.
Michael Catanzaro
Comment 6 2021-12-01 13:47:12 PST
Ack, see: bug #233379 for the warning fix.
EWS
Comment 7 2021-12-01 14:24:50 PST
Committed r286387 (244744@main): <https://commits.webkit.org/244744@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 445607 [details].
Radar WebKit Bug Importer
Comment 8 2021-12-01 14:25:24 PST
Note You need to log in before you can comment on or make changes to this bug.