Closed Bug 1437532 Opened 6 years ago Closed 6 years ago

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

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox60 --- wontfix
firefox61 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In file included from /root/firefox-gcc-last/js/src/jsobj.h:12,
                  from /root/firefox-gcc-last/js/src/vm/Scope.h:13,
                  from /root/firefox-gcc-last/js/src/frontend/NameAnalysisTypes.h:12,
                  from /root/firefox-gcc-last/js/src/jsscript.h:22,
                  from /root/firefox-gcc-last/js/src/vm/Runtime.h:25,
                  from /root/firefox-gcc-last/js/src/jscntxt.h:22,
                  from /root/firefox-gcc-last/js/src/vm/RegExpObject.h:15,
                  from /root/firefox-gcc-last/js/src/builtin/RegExp.h:10,
                  from /root/firefox-gcc-last/js/src/builtin/RegExp.cpp:7:
 /root/firefox-gcc-last/js/src/gc/Barrier.h:655:7: note: 'class js::HeapSlot' declared here
  class HeapSlot : public WriteBarrieredBase<Value>
        ^~~~~~~~
 In file included from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/HashTable.h:18,
                  from /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/TracingAPI.h:12,
                  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/GCVector.h:12,
                  from /root/firefox-gcc-last/js/src/jscntxt.h:15,
                  from /root/firefox-gcc-last/js/src/vm/RegExpObject.h:15,
                  from /root/firefox-gcc-last/js/src/builtin/RegExp.h:10,
                  from /root/firefox-gcc-last/js/src/builtin/RegExp.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::TabSizes]':
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/js/MemoryMetrics.h:40:39:   required from here
 /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/PodOperations.h:32:9: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct JS::TabSizes'; use assignment or value-initialization instead [-Wclass-memaccess]
    memset(aT, 0, sizeof(T));
    ~~~~~~^~~~~~~~~~~~~~~~~~
Andi, could you please take care of that? Thanks!
Assignee: nobody → bpostelnicu
Summary: /PodOperations.h:32:9: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct JS::TabSizes'; use assignment or value-initialization instead [-Wclass-memaccess] → PodOperations.h:32:9: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct JS::TabSizes'; use assignment or value-initialization instead [-Wclass-memaccess]
Component: MFBT → JavaScript Engine
Comment on attachment 8958380 [details]
Bug 1437532 - prevent doing memset on a non-trivial type.

https://reviewboard.mozilla.org/r/227330/#review233494

Stealing trivial review.
Attachment #8958380 - Flags: review+
Priority: -- → P2
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8e53f08e1d90
prevent doing memset on a non-trivial type. r=jorendorff
https://hg.mozilla.org/mozilla-central/rev/8e53f08e1d90
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Attachment #8958380 - Flags: review?(n.nethercote)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: