Bug 135205 - [Win] Lots of compiler warnings on Windows
Summary: [Win] Lots of compiler warnings on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
: 125122 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-07-23 11:57 PDT by Brent Fulgham
Modified: 2015-02-02 16:32 PST (History)
5 users (show)

See Also:


Attachments
the patch. (10.08 KB, patch)
2014-10-06 15:08 PDT, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2014-07-23 11:57:10 PDT
I see a lot of compiler warnings from JavaScriptCore when building on Windows:

LLIntOffsetsExtractor, JavaScriptCore: Configuration: Debug x64
7>c:\projects\webkit\opensource\webkitbuild\debug\include\private\javascriptcore\MacroAssemblerX86_64.h(206): warning C4307: '*' : integral constant overflow
7>c:\projects\webkit\opensource\webkitbuild\debug\include\private\javascriptcore\MacroAssemblerX86_64.h(210): warning C4307: '*' : integral constant overflow

JavaScriptCore: Configuration: Debug x64
9>c:\projects\webkit\opensource\source\javascriptcore\dfg\DFGEdge.h(208): warning C4805: '|' : unsafe mix of type 'uintptr_t' and type 'bool' in operation (..\dfg\DFGAbstractValue.cpp)
9>c:\projects\webkit\opensource\source\javascriptcore\dfg\DFGCommon.h(251): warning C4805: '==' : unsafe mix of type 'bool' and type 'int' in operation (..\dfg\DFGAbstractValue.cpp)
9>          c:\projects\webkit\opensource\source\javascriptcore\dfg\DFGVariableAccessData.h(74) : see reference to function template instantiation 'bool JSC::DFG::checkAndSet<bool,int>(T &,U)' being compiled
9>          with
9>          [
9>              T=bool
9>  ,            U=int
9>          ]
9>c:\projects\webkit\opensource\source\javascriptcore\dfg\dfgnodeflags.h(112): warning C4701: potentially uninitialized local variable 'mask' used
9>c:\projects\webkit\opensource\source\javascriptcore\dfg\dfgnodeflags.h(129): warning C4701: potentially uninitialized local variable 'mask' used
9>c:\projects\webkit\opensource\source\javascriptcore\runtime\jsdataviewprototype.cpp(136): warning C4701: potentially uninitialized local variable 'u' used

These messages turn up hundreds of times in the build log, making it difficult to find 'real' warnings.
Comment 1 Radar WebKit Bug Importer 2014-08-27 15:26:32 PDT
<rdar://problem/18154531>
Comment 2 Mark Lam 2014-10-06 15:08:15 PDT
Created attachment 239361 [details]
the patch.
Comment 3 Geoffrey Garen 2014-10-06 15:11:45 PDT
Comment on attachment 239361 [details]
the patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=239361&action=review

r=me

> Source/JavaScriptCore/dfg/DFGArgumentPosition.h:67
> +        return checkAndSet(m_shouldNeverUnbox, m_shouldNeverUnbox || shouldNeverUnbox);

Why is this needed?
Comment 4 Mark Lam 2014-10-06 15:13:47 PDT
Comment on attachment 239361 [details]
the patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=239361&action=review

>> Source/JavaScriptCore/dfg/DFGArgumentPosition.h:67
>> +        return checkAndSet(m_shouldNeverUnbox, m_shouldNeverUnbox || shouldNeverUnbox);
> 
> Why is this needed?

Windows MSVC does not like bitwise ORing booleans.  That's what it was warning about, and flooding the build output with warning messages.
Comment 5 Mark Lam 2014-10-06 15:15:47 PDT
Comment on attachment 239361 [details]
the patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=239361&action=review

>>> Source/JavaScriptCore/dfg/DFGArgumentPosition.h:67
>>> +        return checkAndSet(m_shouldNeverUnbox, m_shouldNeverUnbox || shouldNeverUnbox);
>> 
>> Why is this needed?
> 
> Windows MSVC does not like bitwise ORing booleans.  That's what it was warning about, and flooding the build output with warning messages.

To be accurate, the checkAndSet() template function compares the 2 arguments.  Using a bitwise OR results in the second argument becoming type int.  MSVC did not like a comparing a bool (first argument) to an int (second arg) in the reification of the template code.
Comment 6 Mark Lam 2014-10-06 15:17:58 PDT
Thanks.  Landed in r174371: <http://trac.webkit.org/r174371>.
Comment 7 Geoffrey Garen 2014-10-06 15:20:27 PDT
> To be accurate, the checkAndSet() template function compares the 2 arguments.  Using a bitwise OR results in the second argument becoming type int.  MSVC did not like a comparing a bool (first argument) to an int (second arg) in the reification of the template code.

A slightly better option here is probably to static_cast the result to bool. The original programmer did not intend for this code to include a branch, and the build fix introduced a logical branch. (Hopefully, the compiler will eliminate the logical branch, but still, it's nice for build fixes to honor the original programmer's intention.)
Comment 8 Mark Lam 2015-02-02 16:32:05 PST
*** Bug 125122 has been marked as a duplicate of this bug. ***