Bug 206190 - Enable -Wconditional-uninitialized in bmalloc, WTF, JavaScriptCore
Summary: Enable -Wconditional-uninitialized in bmalloc, WTF, JavaScriptCore
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-01-13 13:05 PST by David Kilzer (:ddkilzer)
Modified: 2020-01-20 12:38 PST (History)
9 users (show)

See Also:


Attachments
Patch v1 (10.44 KB, patch)
2020-01-13 13:23 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (11.81 KB, patch)
2020-01-13 14:52 PST, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-01-13 13:05:27 PST
Enable -Wconditional-uninitialized in bmalloc, WTF, JavaScriptCore.

Neither bmalloc nor WTF have any warnings.

This fixes the following warnings in JavaScriptCore:


Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:3428:24: error: variable 'continuation' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            m_out.jump(continuation);
                       ^~~~~~~~~~~~
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:3411:33: note: initialize the variable 'continuation' to silence this warning
        LBasicBlock continuation;
                                ^
                                 = nullptr
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:3429:42: error: variable 'lastNext' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            m_out.appendTo(continuation, lastNext);
                                         ^~~~~~~~
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:3412:29: note: initialize the variable 'lastNext' to silence this warning
        LBasicBlock lastNext;
                            ^
                             = nullptr
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:13299:44: error: variable 'globalObject' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            patchpoint->appendSomeRegister(globalObject);
                                           ^~~~~~~~~~~~
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:13288:28: note: initialize the variable 'globalObject' to silence this warning
        LValue globalObject;
                           ^
                            = nullptr
3 errors generated.


In file included from Release/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource63.cpp:1:
./ftl/FTLThunks.cpp:170:28: error: variable 'someGPR' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
        jit.move64ToDouble(someGPR, reg.fpr());
                           ^~~~~~~
./ftl/FTLThunks.cpp:157:5: note: variable 'someGPR' is declared here
    GPRReg someGPR;
    ^
1 error generated.


In file included from Release/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource137.cpp:8:
./wasm/js/WebAssemblyTablePrototype.cpp:145:35: error: variable 'wasmWrapperFunction' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
                table->set(index, wasmWrapperFunction);
                                  ^~~~~~~~~~~~~~~~~~~
./wasm/js/WebAssemblyTablePrototype.cpp:133:56: note: initialize the variable 'wasmWrapperFunction' to silence this warning
        WebAssemblyWrapperFunction* wasmWrapperFunction;
                                                       ^
                                                        = nullptr
./wasm/js/WebAssemblyTablePrototype.cpp:142:17: error: variable 'wasmFunction' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            if (wasmFunction)
                ^~~~~~~~~~~~
./wasm/js/WebAssemblyTablePrototype.cpp:132:42: note: initialize the variable 'wasmFunction' to silence this warning
        WebAssemblyFunction* wasmFunction;
                                         ^
                                          = nullptr
2 errors generated.


Source/JavaScriptCore/b3/testb3_4.cpp:870:36: error: variable 'arg' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    CHECK(compileAndRun<int>(proc, arg) == 8675309);
                                   ^~~
In file included from Source/JavaScriptCore/b3/testb3_4.cpp:27:
Source/JavaScriptCore/b3/testb3.h:106:12: note: expanded from macro 'CHECK'
    if (!!(x))                                                      \
           ^
Source/JavaScriptCore/b3/testb3_4.cpp:851:18: note: initialize the variable 'arg' to silence this warning
    uintptr_t arg;
                 ^
                  = 0
Source/JavaScriptCore/b3/testb3_4.cpp:859:6: error: variable 'slot' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    *slot = 8675309;
     ^~~~
Source/JavaScriptCore/b3/testb3_4.cpp:850:14: note: initialize the variable 'slot' to silence this warning
    int* slot;
             ^
              = nullptr
2 errors generated.
Comment 1 Radar WebKit Bug Importer 2020-01-13 13:05:49 PST
<rdar://problem/58540387>
Comment 2 David Kilzer (:ddkilzer) 2020-01-13 13:23:07 PST
Created attachment 387564 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2020-01-13 13:26:00 PST
Comment on attachment 387564 [details]
Patch v1

Oops, different variables aren't initialized on iOS.
Comment 4 David Kilzer (:ddkilzer) 2020-01-13 14:37:01 PST
(In reply to David Kilzer (:ddkilzer) from comment #3)
> Comment on attachment 387564 [details]
> Patch v1
> 
> Oops, different variables aren't initialized on iOS.


In file included from Release-iphoneos/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource12.cpp:7:
./b3/B3LowerToAir.cpp:2298:34: error: variable 'strongFailBlock' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
                comparisonFail = strongFailBlock;
                                 ^~~~~~~~~~~~~~~
./b3/B3LowerToAir.cpp:2291:41: note: initialize the variable 'strongFailBlock' to silence this warning
        Air::BasicBlock* strongFailBlock;
                                        ^
                                         = nullptr
1 error generated.


And there are additional errors for Debug builds:


In file included from WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource129.cpp:1:
In file included from ./wasm/WasmB3IRGenerator.cpp:58:
./wasm/WasmFunctionParser.h:238:12: error: variable 'op' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
    ASSERT(op == OpType::End);
           ^~
In file included from WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource129.cpp:1:
In file included from ./wasm/WasmB3IRGenerator.cpp:26:
In file included from Source/JavaScriptCore/config.h:38:
In file included from Debug/usr/local/include/wtf/FastMalloc.h:26:
In file included from Debug/usr/local/include/wtf/StdLibExtras.h:32:
Debug/usr/local/include/wtf/Assertions.h:324:11: note: expanded from macro 'ASSERT'
    if (!(assertion)) { \
          ^~~~~~~~~
In file included from WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource129.cpp:1:
In file included from ./wasm/WasmB3IRGenerator.cpp:58:
./wasm/WasmFunctionParser.h:208:31: note: in instantiation of member function 'JSC::Wasm::FunctionParser<JSC::Wasm::B3IRGenerator>::parseBody' requested here
    WASM_FAIL_IF_HELPER_FAILS(parseBody());
                              ^
In file included from WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource129.cpp:1:
./wasm/WasmB3IRGenerator.cpp:1991:38: note: in instantiation of member function 'JSC::Wasm::FunctionParser<JSC::Wasm::B3IRGenerator>::parse' requested here
    WASM_FAIL_IF_HELPER_FAILS(parser.parse());
                                     ^
In file included from WebKitBuild/Debug/DerivedSources/JavaScriptCore/unified-sources/UnifiedSource129.cpp:1:
In file included from ./wasm/WasmB3IRGenerator.cpp:58:
./wasm/WasmFunctionParser.h:217:15: note: initialize the variable 'op' to silence this warning
    uint8_t op;
              ^
               = '\0'
1 error generated.
Comment 5 David Kilzer (:ddkilzer) 2020-01-13 14:52:12 PST
Created attachment 387570 [details]
Patch v2
Comment 6 David Kilzer (:ddkilzer) 2020-01-13 16:42:05 PST
The "jsc" bot failure:

{"allMasmTestsPassed":true,"allApiTestsPassed":true,"stressTestFailures":["wasm.yaml/wasm/lowExecutableMemory/imports-oom.js.default-wasm"],"allDFGTestsPassed":true,"allB3TestsPassed":true,"allAirTestsPassed":true}

Waiting to see if this failure is specific to this patch.
Comment 7 David Kilzer (:ddkilzer) 2020-01-13 16:42:49 PST
(In reply to David Kilzer (:ddkilzer) from comment #6)
> The "jsc" bot failure:
> 
> {"allMasmTestsPassed":true,"allApiTestsPassed":true,"stressTestFailures":
> ["wasm.yaml/wasm/lowExecutableMemory/imports-oom.js.default-wasm"],
> "allDFGTestsPassed":true,"allB3TestsPassed":true,"allAirTestsPassed":true}
> 
> Waiting to see if this failure is specific to this patch.

Hmmm, the results just turned green.

Waiting for remaining bots to go green before cq+.
Comment 8 David Kilzer (:ddkilzer) 2020-01-13 21:16:34 PST
The mac-debug-wk1 failure is unrelated.
Comment 9 WebKit Commit Bot 2020-01-14 00:40:54 PST
Comment on attachment 387570 [details]
Patch v2

Clearing flags on attachment: 387570

Committed r254500: <https://trac.webkit.org/changeset/254500>
Comment 10 WebKit Commit Bot 2020-01-14 00:40:56 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 David Kilzer (:ddkilzer) 2020-01-14 09:35:00 PST
(In reply to David Kilzer (:ddkilzer) from comment #8)
> The mac-debug-wk1 failure is unrelated.

Filed Bug 206241 for this.