Bug 143770 - GCC warns that JSValue v is used without initialization
Summary: GCC warns that JSValue v is used without initialization
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 133028
  Show dependency treegraph
 
Reported: 2015-04-15 06:32 PDT by LRN
Modified: 2015-04-21 04:07 PDT (History)
2 users (show)

See Also:


Attachments
Silence the warning about JSValue 'v' being uninitialized (4.39 KB, patch)
2015-04-15 10:12 PDT, LRN
ap: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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