[Webkit-unassigned] [Bug 211701] New: -Wtype-limits warning spam from CCallHelpers.h

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 10 13:09:36 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=211701

            Bug ID: 211701
           Summary: -Wtype-limits warning spam from CCallHelpers.h
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at gnome.org
                CC: bugs-noreply at webkitgtk.org

The stable release of GCC 10 has started warning about some preexisting code in CCallHelpers.h. This one is really long, but I'm going to copy the whole thing because the template instantiation is important here. It's four separate warnings; I've added a newline between each one for readability:

[821/2747] Building CXX object Source/JavaScriptCore/CMak...ScriptCore/unified-sources/UnifiedSource-f0a787a9-1.cpp.o
In file included from /home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/AccessCase.cpp:31,
                 from DerivedSources/JavaScriptCore/unified-sources/UnifiedSource-f0a787a9-1.cpp:1:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘std::array<RegType, NumberOfRegisters> JSC::CCallHelpers::clampArrayToSize(std::array<RegType, decltype (JSC::toInfoFromReg((RegType)(-1)))::numberOfRegisters>) [with unsigned int TargetSize = 0; RegType = JSC::X86Registers::XMMRegisterID; decltype (JSC::toInfoFromReg((RegType)(-1))) = JSC::FPRInfo]’:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:645:85:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 2; unsigned int numGPRSources = 1; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:381:46:   required from ‘void JSC::CCallHelpers::marshallArgumentRegister(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, RegType, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; RegType = JSC::X86Registers::RegisterID; Args = {}]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:399:48:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, JSC::GPRReg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Args = {}; JSC::GPRReg = JSC::X86Registers::RegisterID]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:579:46:   required from ‘std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, Arg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 0; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Arg = JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr; Args = {JSC::X86Registers::RegisterID}; std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> = void]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:669:63:   required from ‘std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> JSC::CCallHelpers::setupArguments(Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); Args = {JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr, JSC::X86Registers::RegisterID}; std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> = void; typename WTF::FunctionTraits<T>::ArgumentType<0> = JSC::VM*]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/AccessCase.cpp:1851:161:   required from here
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:316:32: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  316 |         for (unsigned i = 0; i < TargetSize; i++) {
      |                              ~~^~~~~~~~~~~~

/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘void JSC::CCallHelpers::setupStubArgs(std::array<RegType, NumberOfRegisters>, std::array<RegType, NumberOfRegisters>) [with unsigned int NumberOfRegisters = 0; RegType = JSC::X86Registers::XMMRegisterID]’:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:645:45:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 2; unsigned int numGPRSources = 1; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:381:46:   required from ‘void JSC::CCallHelpers::marshallArgumentRegister(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, RegType, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; RegType = JSC::X86Registers::RegisterID; Args = {}]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:399:48:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, JSC::GPRReg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Args = {}; JSC::GPRReg = JSC::X86Registers::RegisterID]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:579:46:   required from ‘std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, Arg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 0; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Arg = JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr; Args = {JSC::X86Registers::RegisterID}; std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> = void]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:669:63:   required from ‘std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> JSC::CCallHelpers::setupArguments(Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); Args = {JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr, JSC::X86Registers::RegisterID}; std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> = void; typename WTF::FunctionTraits<T>::ArgumentType<0> = JSC::VM*]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/AccessCase.cpp:1851:161:   required from here
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:102:32: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  102 |         for (unsigned i = 0; i < NumberOfRegisters; ++i) {
      |                              ~~^~~~~~~~~~~~~~~~~~~

/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘std::array<RegType, NumberOfRegisters> JSC::CCallHelpers::clampArrayToSize(std::array<RegType, decltype (JSC::toInfoFromReg((RegType)(-1)))::numberOfRegisters>) [with unsigned int TargetSize = 0; RegType = JSC::X86Registers::RegisterID; decltype (JSC::toInfoFromReg((RegType)(-1))) = JSC::GPRInfo]’:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:639:85:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 2; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:386:42:   required from ‘void JSC::CCallHelpers::marshallArgumentRegister(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, RegType, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; RegType = JSC::X86Registers::RegisterID; Args = {}]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:399:48:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, JSC::GPRReg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Args = {}; JSC::GPRReg = JSC::X86Registers::RegisterID]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:579:46:   required from ‘std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, Arg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 0; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Arg = JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr; Args = {JSC::X86Registers::RegisterID}; std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> = void]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:669:63:   required from ‘std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> JSC::CCallHelpers::setupArguments(Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); Args = {JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr, JSC::X86Registers::RegisterID}; std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> = void; typename WTF::FunctionTraits<T>::ArgumentType<0> = JSC::VM*]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/AccessCase.cpp:1851:161:   required from here
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:316:32: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  316 |         for (unsigned i = 0; i < TargetSize; i++) {
      |                              ~~^~~~~~~~~~~~

/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘void JSC::CCallHelpers::setupStubArgs(std::array<RegType, NumberOfRegisters>, std::array<RegType, NumberOfRegisters>) [with unsigned int NumberOfRegisters = 0; RegType = JSC::X86Registers::RegisterID]’:
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:639:45:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 2; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:386:42:   required from ‘void JSC::CCallHelpers::marshallArgumentRegister(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, RegType, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; RegType = JSC::X86Registers::RegisterID; Args = {}]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:399:48:   required from ‘void JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, JSC::GPRReg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 1; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Args = {}; JSC::GPRReg = JSC::X86Registers::RegisterID]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:579:46:   required from ‘std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> JSC::CCallHelpers::setupArgumentsImpl(JSC::CCallHelpers::ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, numCrossSources, extraGPRArgs, extraPoke>, Arg, Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); unsigned int numGPRArgs = 0; unsigned int numGPRSources = 0; unsigned int numFPRArgs = 0; unsigned int numFPRSources = 0; unsigned int numCrossSources = 0; unsigned int extraGPRArgs = 0; unsigned int extraPoke = 0; Arg = JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr; Args = {JSC::X86Registers::RegisterID}; std::enable_if_t<(std::is_base_of<JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm, Arg>::value || std::is_convertible<Arg, JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImm>::value)> = void]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:669:63:   required from ‘std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> JSC::CCallHelpers::setupArguments(Args ...) [with OperationType = char*(JSC::VM*, JSC::JSObject*); Args = {JSC::AbstractMacroAssembler<JSC::X86Assembler>::TrustedImmPtr, JSC::X86Registers::RegisterID}; std::enable_if_t<(! std::is_same<typename WTF::FunctionTraits<T>::ArgumentType<0>, JSC::CallFrame*>::value)> = void; typename WTF::FunctionTraits<T>::ArgumentType<0> = JSC::VM*]’
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/bytecode/AccessCase.cpp:1851:161:   required from here
/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h:102:32: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  102 |         for (unsigned i = 0; i < NumberOfRegisters; ++i) {
      |                              ~~^~~~~~~~~~~~~~~~~~~

So looking at the code, one would think "well, the template should never be instantiated with TargetSize == or NumberOfRegisters == 0, and therefore this must be a false positive." But in fact, the templates really are being instantiated with these values, according to the warning:

/home/mcatanzaro/Projects/WebKit/Source/JavaScriptCore/jit/CCallHelpers.h: In instantiation of ‘void JSC::CCallHelpers::setupStubArgs(std::array<RegType, NumberOfRegisters>, std::array<RegType, NumberOfRegisters>) [with unsigned int NumberOfRegisters = 0; RegType = JSC::X86Registers::XMMRegisterID]’:

Seems that's happening here:

    template<typename OperationType, typename... Args>
    ALWAYS_INLINE std::enable_if_t<std::is_same<FIRST_ARGUMENT_TYPE, CallFrame*>::value> setupArguments(Args... args)
    {
#if USE(JSVALUE64)
        // This only really works for 64-bit since jsvalue regs mess things up for 32-bit...
        static_assert(FunctionTraits<OperationType>::cCallArity() == sizeof...(Args) + 1, "Basic sanity check");
#endif
        setupArgumentsImpl<OperationType, 0, 0, 0, 0, 0, 0, 0>(ArgCollection<0, 0, 0, 0, 0, 0, 0>(), GPRInfo::callFrameRegister, args...);
    }

    template<typename OperationType, typename... Args>
    ALWAYS_INLINE std::enable_if_t<!std::is_same<FIRST_ARGUMENT_TYPE, CallFrame*>::value> setupArguments(Args... args)
    {
#if USE(JSVALUE64)
        // This only really works for 64-bit since jsvalue regs mess things up for 32-bit...
        static_assert(FunctionTraits<OperationType>::cCallArity() == sizeof...(Args), "Basic sanity check");
#endif
        setupArgumentsImpl<OperationType, 0, 0, 0, 0, 0, 0, 0>(ArgCollection<0, 0, 0, 0, 0, 0, 0>(), args...);
    }

I tried this naive patch to block that case from being reached at runtime, but it's not enough to avoid the warnings:

diff --git a/Source/JavaScriptCore/jit/CCallHelpers.h b/Source/JavaScriptCore/jit/CCallHelpers.h
index 35d509bc3f54..2c3425edd9f8 100644
--- a/Source/JavaScriptCore/jit/CCallHelpers.h
+++ b/Source/JavaScriptCore/jit/CCallHelpers.h
@@ -99,9 +99,11 @@ private:
         typedef std::pair<RegType, RegType> RegPair;
         Vector<RegPair, NumberOfRegisters> pairs;

-        for (unsigned i = 0; i < NumberOfRegisters; ++i) {
-            if (sources[i] != destinations[i])
-                pairs.append(std::make_pair(sources[i], destinations[i]));
+        if (NumberOfRegisters > 0) {
+            for (unsigned i = 0; i < NumberOfRegisters; ++i) {
+                if (sources[i] != destinations[i])
+                    pairs.append(std::make_pair(sources[i], destinations[i]));
+            }
         }

 #if ASSERT_ENABLED
@@ -313,9 +315,11 @@ private:

         std::array<RegType, TargetSize> result { };

-        for (unsigned i = 0; i < TargetSize; i++) {
-            ASSERT(sourceArray[i] != static_cast<int32_t>(InfoTypeForReg<RegType>::InvalidIndex));
-            result[i] = sourceArray[i];
+        if (TargetSize > 0) {
+            for (unsigned i = 0; i < TargetSize; i++) {
+                ASSERT(sourceArray[i] != static_cast<int32_t>(InfoTypeForReg<RegType>::InvalidIndex));
+                result[i] = sourceArray[i];
+            }
         }

         return result;

I don't pretend to understand the code and I don't know what to do with them. I guess as long as we are instantiating these templates with TargetSize or NumberOfRegisters set to 0, we'll need to create separate template specializations to avoid the warning? I'd sooner just disable the warning with pragmas if it doesn't look like an actual bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200510/2276fe77/attachment-0001.htm>


More information about the webkit-unassigned mailing list