gcc -Wuninitialized warning (uninitialized memory copy) in Nullable's copy ctor when copying default constructed Nullable

RESOLVED DUPLICATE of bug 1025173

Status

()

RESOLVED DUPLICATE of bug 1025173
5 years ago
4 years ago

People

(Reporter: cpeterson, Unassigned)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
I see the following gcc -Wuninitialized warning about an uninitialized memory copy from this code:

https://hg.mozilla.org/mozilla-central/annotate/c7fdd7e755cd/dom/quota/QuotaManager.cpp#l2812

Here is a simplified example:

> Nullable a;
> Nullable b(a); // b's copy ctor copying a's uninitialized mValue


In file included from ../../dist/include/nsIDOMEventTarget.h:18:0,
                 from ../../dist/include/mozilla/dom/EventTarget.h:9,
                 from ../../dist/include/nsPIDOMWindow.h:16,
                 from /builds/slave/try-l64-d-00000000000000000000/build/dom/quota/CheckQuotaHelper.cpp:15,
                 from /builds/slave/try-l64-d-00000000000000000000/build/obj-firefox/dom/quota/Unified_cpp_dom_quota0.cpp:2:
../../dist/include/mozilla/dom/Nullable.h: In member function 'nsresult mozilla::dom::quota::QuotaManager::ClearStoragesForApp(uint32_t, bool)':
../../dist/include/mozilla/dom/Nullable.h:44:27: warning: '*((void*)& persistenceType +4)' may be used uninitialized in this function [-Wuninitialized]
In file included from /builds/slave/try-l64-d-00000000000000000000/build/obj-firefox/dom/quota/Unified_cpp_dom_quota0.cpp:28:0:
/builds/slave/try-l64-d-00000000000000000000/build/dom/quota/QuotaManager.cpp:2808:29: note: '*((void*)& persistenceType +4)' was declared here
(Reporter)

Updated

4 years ago
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1025173
You need to log in before you can comment on or make changes to this bug.