Bug 143770

Summary: GCC warns that JSValue v is used without initialization
Product: WebKit Reporter: LRN <lrn1986>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cgarcia, lrn1986
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 133028    
Attachments:
Description Flags
Silence the warning about JSValue 'v' being uninitialized ap: review-

Description LRN 2015-04-15 06:32:36 PDT
../webkitgtk-2.4.8/Source/JavaScriptCore/runtime/JSObject.cpp: In member function 'JSC::ContiguousJSValues JSC::JSObject::genericConvertDoubleToContiguous(JSC::VM&) [with JSC::JSObject::DoubleToContiguousMode mode = (JSC::JSObject::DoubleToContiguousMode)0u; JSC::ContiguousJSValues = JSC::ContiguousData<JSC::WriteBarrier<JSC::Unknown> >]':
../webkitgtk-2.4.8/Source/JavaScriptCore/runtime/JSObject.cpp:822:17: warning: 'v' is used uninitialized in this function [-Wuninitialized]

This shouldn't really happen, as the enumeration only has two values,
but gcc doesn't seem to understand it. Probably because it's a template.
Also, 'v' is an object, so there's an uninitialized object that participates
in a '=' operator, so that could be the cause for concern as well.
Comment 1 LRN 2015-04-15 10:12:22 PDT
Created attachment 250817 [details]
Silence the warning about JSValue 'v' being uninitialized

This shouldn't really happen, as the enumeration only has two values,
but gcc doesn't seem to understand it. Probably because it's a template.
Also, 'v' is an object, so there's an uninitialized object that participates
in a '=' operator, so that could be the cause for concern as well.

Fix this by completely separating two cases at the cost of code duplication.

Otherwise one would get this:
../webkitgtk-2.4.8/Source/JavaScriptCore/runtime/JSObject.cpp: In member function 'JSC::ContiguousJSValues JSC::JSObject::genericConvertDoubleToContiguous(JSC::VM&) [with JSC::JSObject::DoubleToContiguousMode mode = (JSC::JSObject::DoubleToContiguousMode)0u; JSC::ContiguousJSValues = JSC::ContiguousData<JSC::WriteBarrier<JSC::Unknown> >]':
../webkitgtk-2.4.8/Source/JavaScriptCore/runtime/JSObject.cpp:822:17: warning: 'v' is used uninitialized in this function [-Wuninitialized]
Comment 2 Alexey Proskuryakov 2015-04-15 18:08:53 PDT
Comment on attachment 250817 [details]
Silence the warning about JSValue 'v' being uninitialized

R-, because the patch does not apply to trunk. Also, the change to switch indentation is incorrect per WebKit style.
Comment 3 LRN 2015-04-21 04:07:59 PDT
Maybe this could be fixed by backporting whatever code is in the trunk now? Since this patch does not apply, i'm assuming that the code changed since 2.4.x