Closed Bug 1159131 Opened 9 years ago Closed 9 years ago

dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Wuninitialized]

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

This patch moves the UpdateUpperBound() function's `out_upperBound` parameter to a local variable to work around a false positive -Wuninitialized gcc warning about std::max() template function's arguments in DEBUG PGO builds. PGO opt builds are not affected. The false positive warning is actually about UpdateUpperBound()'s `newBound` variable, not `out_upperBound`, but dereferencing the out_upperBound pointer into a local variable seems less silly than duplicating the newBound parameter into a local variable like `uint32_t newBound2 = newBound` (which also works around the false positive warning).

Why accept this silly workaround for a false positive warning? Because it's the last -Wuninitialized warning in mozilla-central and will allow me to land bug 1001975, removing -Wuninitialized from the warnings exempted from FAIL_ON_WARNINGS warnings-as-errors. gcc's -Wuninitialized has a well-deserved reputation for reporting false positives, but gcc 4.7 (mozilla-central's current minimum gcc version) separated -Wuninitialized's less reliable checks into a new and unreliable -Wmaybe-uninitialized warning. -Wuninitialized warnings are rarely false positives these days.

This patch also changes some (unrelated) MOZ_ASSERTs to MOZ_RELEASE_ASSERTs in the TestWebGLElementArrayCache.cpp file that triggered this -Wuninitialized warning.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=05dd713f8de1

/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
/builds/slave/try-l64-d-00000000000000000000/build/src/dom/canvas/compiledtest/../WebGLElementArrayCache.cpp:245:10: error: 'newBound' may be used uninitialized in this function [-Werror=uninitialized]
Attachment #8598441 - Flags: review?(jgilbert)
Attachment #8598441 - Flags: review?(jgilbert) → review+
https://hg.mozilla.org/mozilla-central/rev/7b6a610e26b9
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.