Bug 125102 - [Win] (32-bit) Warning about truncated constant value in X86Assembler
Summary: [Win] (32-bit) Warning about truncated constant value in X86Assembler
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-02 13:46 PST by Brent Fulgham
Modified: 2015-02-02 15:46 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Fulgham 2013-12-02 13:46:16 PST
Building JavaScriptCore on Windows shows the following warning (dozens of times) during a 32-bit build:

6>c:\projects\webkit\opensource\webkitbuild\release\include\private\javascriptcore\X86Assembler.h(2342): warning C4309: 'argument' : truncation of constant value

The code generating the error is:

        void threeByteOp(ThreeByteOpcodeID opcode)
        {
            m_buffer.ensureSpace(maxInstructionSize);
            m_buffer.putByteUnchecked(OP_2BYTE_ESCAPE);
>>>            m_buffer.putByteUnchecked(OP2_3BYTE_ESCAPE);
            m_buffer.putByteUnchecked(opcode);
        }

The "putByteUnchecked" takes a signed int8_t value.
        void putByteUnchecked(int8_t value) { putIntegralUnchecked(value); }

OP2_3BYTE_ESCAPE is defined as:

        OP2_3BYTE_ESCAPE    = 0xAE

This resolves to decimal 174, which is outside the allowed range of -128 to +127.

I'm not aware of this causing any functional problems, but the warning is annoying, and might signify something bad if the compiler decided to pass (11010001) "-47" instead of (10101110) "+174".
Comment 1 Brent Fulgham 2015-02-02 15:00:23 PST
I think this has been fixed in recent WebKit sources. Can we close?
Comment 2 Mark Lam 2015-02-02 15:46:04 PST
(In reply to comment #1)
> I think this has been fixed in recent WebKit sources. Can we close?

I don't see any changes that could have made this warning go away.  Has it stopped manifesting?