Closed Bug 1461600 Opened 6 years ago Closed 6 years ago

PodOperations.h:32:9: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct JS::ServoSizes'; use assignment or value-initialization instead [-Werror=class-memaccess]

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1437532 +++

 In file included from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/HashTable.h:19,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/TracingAPI.h:11,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/GCPolicyAPI.h:47,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/RootingAPI.h:22,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/CallArgs.h:73,
                  from /root/firefox-gcc-last/js/src/jsapi.h:29,
                  from /root/firefox-gcc-last/js/src/jsfriendapi.h:16,
                  from /root/firefox-gcc-last/js/src/vm/NativeObject.h:15,
                  from /root/firefox-gcc-last/js/src/vm/ArrayObject.h:10,
                  from /root/firefox-gcc-last/js/src/builtin/Array.h:16,
                  from /root/firefox-gcc-last/js/src/builtin/Array-inl.h:10,
                  from /root/firefox-gcc-last/js/src/builtin/Array.cpp:7:
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/PodOperations.h: In instantiation of 'void mozilla::PodZero(T*) [with T = JS::ServoSizes]':
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/MemoryMetrics.h:77:41:   required from here
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/PodOperations.h:32:9: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct JS::ServoSizes'; use assignment or value-initialization instead [-Werror=class-memaccess]
    memset(aT, 0, sizeof(T));
    ~~~~~~^~~~~~~~~~~~~~~~~~
Assignee: nobody → bpostelnicu
Attachment #8975785 - Flags: review?(n.nethercote)
Attachment #8975785 - Flags: review?(n.nethercote) → review?(jwalden+bmo)
Comment on attachment 8975785 [details]
Bug 1461600 - avoid doing memset on ServoSizes since it's not POD.

https://reviewboard.mozilla.org/r/243990/#review250150

Stealing this trivial review.
Attachment #8975785 - Flags: review+
Attachment #8975785 - Flags: review?(jwalden+bmo)
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d5db2927b771
avoid doing memset on ServoSizes since it's not POD. r=njn
Guh.  I have a better fix in bug 1461556 that uses member initializers.  Might end up I back this out when I land that.  Oh well.
(In reply to Jeff Walden [:Waldo] from comment #4)
> Guh.  I have a better fix in bug 1461556 that uses member initializers. 
> Might end up I back this out when I land that.  Oh well.
Don’t tell me just let me guess :) you marked with default the ctor and you initialized in place each member?
https://hg.mozilla.org/mozilla-central/rev/d5db2927b771
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: