mov eax, ~(1<<31)
Still producing "dword data exceeds bounds.
The right hand expression has the value of 0xFFFF_FFFF_7FFF_FFFF which is correctly not either sign- or zero-extendable from the 32-bit truncated value. The issue here is the handling of - or ~ in these kinds of expressions: they end up extending an expression theoretically "to infinity", even though that is presumably not the intention of the programmer.
> even though that is presumably not the
> intention of the programmer.
The programmer's intent is not clear from
the code. Yes, EAX suggests 32 bits... but
no, it's not sufficient to suggest that there
should be no bounds warnings.
The programmer should explicitly specify
mov eax, 0xFFFFFFFF & (~(1<<31)) so that
the 32-bit intent becomes non-ambiguous
and the warning goes away.
I don't think typing eax, 0xFFFFFFFF & (~(1<<31)) is a good idea. In real we should check the size of destination, if it fits the source -- then no warning here.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.