[Webkit-unassigned] [Bug 95418] Build warning : -Wsign-compare on DFGByteCodeParser.cpp.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 29 22:47:47 PDT 2012


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


Filip Pizlo <fpizlo at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #161393|review+                     |review-
               Flag|                            |




--- Comment #4 from Filip Pizlo <fpizlo at apple.com>  2012-08-29 22:47:53 PST ---
(From update of attachment 161393)
View in context: https://bugs.webkit.org/attachment.cgi?id=161393&action=review

I think what you're hitting here is that different compilers have different opinions about what the sign of arithmetic on a part signed, part unsigned expression is.  On our build system, the current setup works - these comparisons are all signed versus signed.  If your build system disagrees (which it apparently is doing), you should insert casts into the arithmetic (inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset(), and inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize - inlineCallFrame->arguments.size()) to ensure that it stays signed all the way through.

And please don't change operand variables to unsigned.  Operands are always signed, since negative operand values carry special meaning.

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:362
> -    ArgumentPosition* findArgumentPositionForLocal(int operand)
> +    ArgumentPosition* findArgumentPositionForLocal(unsigned operand)

This is wrong.  Operands are always signed integers.

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:370
> -            if (operand == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset())
> +            if (static_cast<int>(operand) == inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset())

Change the right hand side of this to static_cast<int>(inlineCallFrame->...)

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:372
> -            if (static_cast<unsigned>(operand) < inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize - inlineCallFrame->arguments.size())
> +            if (operand < inlineCallFrame->stackOffset - RegisterFile::CallFrameHeaderSize - inlineCallFrame->arguments.size())

Same as above.  Change the right hand side to a cast to int.

> Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:374
> -            int argument = operandToArgument(operand - inlineCallFrame->stackOffset);
> +            int argument = operandToArgument(static_cast<int>(operand) - inlineCallFrame->stackOffset);

Remove this.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list