Closed Bug 1430729 Opened 2 years ago Closed 2 years ago
Auto Ptr<mozilla::Sandbox Reporter>::m Raw Ptr' is used uninitialized in this function [-Werror=uninitialized]
59 bytes, text/x-review-board-request
with gcc 8-20180110-1 In file included from /root/firefox-gcc-last/security/sandbox/linux/reporter/SandboxReporter.h:13, from /root/firefox-gcc-last/security/sandbox/linux/reporter/SandboxReporter.cpp:7: /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/StaticPtr.h: In constructor 'mozilla::StaticAutoPtr<T>::StaticAutoPtr() [with T = mozilla::SandboxReporter]': /root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/StaticPtr.h:48:17: error: '*<unknown>.mozilla::StaticAutoPtr<mozilla::SandboxReporter>::mRawPtr' is used uninitialized in this function [-Werror=uninitialized] MOZ_ASSERT(!mRawPtr); ^~~~~~~ cc1plus: all warnings being treated as errors Not sure if this is a bug in the compiler false positive or not.
I think we intended not to assign the value for https://searchfox.org/mozilla-central/rev/41925c0b6c6d58578690121de439d2a8d3d690f3/xpcom/base/StaticPtr.h#48 we assume client should use this object as a global object that means it will be located in BSS section with auto zero initialization. How could we work around for this warning?
Comment 1 is correct; mRawPtr will always be zero-initialized by the runtime system. But the compiler can't know that we're always going to use these objects at file scope, so it complains. #pragma GCC warning disable seems like a reasonable workaround. Want to try that, Sylvestre?
Is that what you are expecting? Thanks!
Comment on attachment 8942913 [details] Bug 1430729 - Ignore an incorrect warning with gcc (-Wuninitialized) https://reviewboard.mozilla.org/r/213182/#review218858 Thank you!
Attachment #8942913 - Flags: review?(nfroyd) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/55b7690ea8c5 Ignore an incorrect warning with gcc (-Wuninitialized) r=froydnj
Backed out for build bustage z:\build\build\src\obj-firefox\dist\include\mozilla/StaticPtr.h(107): error C2220 on a CLOSED TREE Push that cause the bustages: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=55b7690ea8c554e12d11ea015c90a0e2bd115389 Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=156599549&repo=autoland&lineNumber=7094 Backout: https://hg.mozilla.org/integration/autoland/rev/b2588a5584c200b9dac8a6a0b0500f043cd335fe
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/263b74db7a7c Ignore an incorrect warning with gcc (-Wuninitialized) r=froydnj
According to the autoland CI, we are much better now!
You need to log in before you can comment on or make changes to this bug.