<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>226643</bug_id>
          
          <creation_ts>2021-06-04 07:29:32 -0700</creation_ts>
          <short_desc>-Wnonnull warning in JITCall.cpp</short_desc>
          <delta_ts>2021-06-12 16:10:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=226193</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>155047</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Michael Catanzaro">mcatanzaro</assigned_to>
          <cc>aperez</cc>
    
    <cc>darin</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>tzagallo</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1766756</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-04 07:29:32 -0700</bug_when>
    <thetext>[3/3414] Building CXX object Source/JavaScriptCore/CMakeF...vedSources/unified-sources/UnifiedSource-3a3c4ec0-3.cpp.o
In file included from JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-3.cpp:7:
../../Source/JavaScriptCore/jit/JITCall.cpp: In member function ‘void JSC::JIT::compileOpCall(const JSC::Instruction*, unsigned int) [with Op = JSC::OpCallEval]’:
../../Source/JavaScriptCore/jit/JITCall.cpp:256:10: warning: ‘this’ pointer is null [-Wnonnull]
  256 |     auto slowPaths = info-&gt;emitFastPath(*this, regT0, regT2, CallLinkInfo::UseDataIC::Yes);
      |          ^~~~~~~~~
In file included from ../../Source/JavaScriptCore/bytecode/CodeBlock.h:34,
                 from ../../Source/JavaScriptCore/jit/AssemblyHelpers.h:30,
                 from ../../Source/JavaScriptCore/jit/CCallHelpers.h:30,
                 from ../../Source/JavaScriptCore/jit/JITAddGenerator.h:30,
                 from ../../Source/JavaScriptCore/jit/JITAddGenerator.cpp:27,
                 from JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-3a3c4ec0-3.cpp:1:
../../Source/JavaScriptCore/bytecode/CallLinkInfo.h:178:30: note: in a call to non-static member function ‘JSC::AbstractMacroAssembler&lt;JSC::X86Assembler&gt;::JumpList JSC::CallLinkInfo::emitFastPath(JSC::CCallHelpers&amp;, JSC::GPRReg, JSC::GPRReg, JSC::CallLinkInfo::UseDataIC)’
  178 |     MacroAssembler::JumpList emitFastPath(CCallHelpers&amp;, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC) WARN_UNUSED_RETURN;
      |                              ^~~~~~~~~~~~

Despite the very misleading text of the warning, GCC is concerned that *info* may be NULL at JITCall.cpp:256. (It&apos;s concerned about the value of &apos;this&apos; *inside* the call to info-&gt;emitFastPath.) Would be great if a JavaScriptCore developer could investigate it, please. From my amateurish read of the code, it sure *looks* like GCC&apos;s warning is reasonable as there appear to be codepaths where info is NULL at that point.

The warning may be suppressed either with IGNORE_WARNINGS_BEGIN/END or by adding a RELEASE_ASSERT(info).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1768927</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-06-11 07:30:29 -0700</bug_when>
    <thetext>&lt;rdar://problem/79197261&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769185</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2021-06-11 22:38:50 -0700</bug_when>
    <thetext>GCC&apos;s warning looks wrong. it is nullptr only when opcodeID is op_call_eval. And these cases are handled in

if (compileCallEval(bytecode))
    return;

So, L256, it must be a non nullptr.
My intuition is that GCC&apos;s implementation of this warning looks broken :(

Did we found a real bug with this warning so far?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769191</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-12 05:35:43 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #2)
&gt; Did we found a real bug with this warning so far?

Yes, that&apos;s what the IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN macro is for. 

The GCC developers are going to say it&apos;s not a bug because the warning is not intended to avoid all possible false-positives, so let&apos;s use IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769192</commentid>
    <comment_count>4</comment_count>
      <attachid>431254</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-12 05:37:39 -0700</bug_when>
    <thetext>Created attachment 431254
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769193</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-12 05:39:56 -0700</bug_when>
    <thetext>(Alternatively: we could use -Wno-nonnull globally when building with GCC, and rely on developers building with Clang to catch real -Wnonnull problems.)

I think it&apos;s few enough cases so far that the macro is OK for now, but they are unfortunately in some awkward places (e.g. RefPtr.h):

$ git grep IGNORE_ERRONEOUS
WTF/wtf/Compiler.h:#define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN IGNORE_GCC_WARNINGS_BEGIN(&quot;nonnull&quot;)
WTF/wtf/Compiler.h:#define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END IGNORE_GCC_WARNINGS_END
WTF/wtf/RefPtr.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
WTF/wtf/RefPtr.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
WebCore/css/CSSValue.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
WebCore/css/CSSValue.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
WebCore/css/StyleRule.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
WebCore/css/StyleRule.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
WebCore/dom/Node.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
WebCore/dom/Node.h:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END
WebKit/WebProcess/Plugins/PluginView.cpp:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN
WebKit/WebProcess/Plugins/PluginView.cpp:IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769225</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-06-12 15:34:57 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #3) 
&gt; The GCC developers are going to say it&apos;s not a bug because the warning is
&gt; not intended to avoid all possible false-positives, so let&apos;s use
&gt; IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN.

Reference for this: https://bugzilla.redhat.com/show_bug.cgi?id=1948775#c4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1769227</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-06-12 16:09:58 -0700</bug_when>
    <thetext>Committed r278816 (238769@main): &lt;https://commits.webkit.org/238769@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431254.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>431254</attachid>
            <date>2021-06-12 05:37:39 -0700</date>
            <delta_ts>2021-06-12 16:09:59 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-226643-20210612073738.patch</filename>
            <type>text/plain</type>
            <size>1458</size>
            <attacher name="Michael Catanzaro">mcatanzaro</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc4NzE5CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBj
NjIwYzBmMjE5N2JlY2NhYzNmMmU2Mzg0MjlmODQwMjhkZGE4NjU5Li40YTY0YTI5ODk4YmRmNDNm
OTA0NDMxNjU5ZjhlNjllYTUxOTdmYzJmIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNyBAQAorMjAyMS0wNi0xMiAgTWljaGFlbCBDYXRhbnphcm8gIDxtY2F0YW56YXJvQGdu
b21lLm9yZz4KKworICAgICAgICAtV25vbm51bGwgd2FybmluZyBpbiBKSVRDYWxsLmNwcAorICAg
ICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ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