|
From: John R.
|
> The problem is that 'andl $-2, 8(%esp)' sets %eflags to undefined. The fact that 8(%esp) is undefined implies only that the PF [parity], SF [sign], and ZF [zero] flags become logically undefined. On x86 each integer AND instruction clears both the CF [carry] and OF [overflow] flags unconditionally, regardless of operands. Also regardless of operands, on x86 an integer AND instruction sets AF [ASCII Carry out of bit 3] to undefined. > main: > subl $24, %esp > andl $-2, 8(%esp) Note that if the constant operand were -256 then the PF would be defined [to be Even parity] because the PF is computed on the low-order 8 bits only, and the low-order 8 bits would become all zero even if 8(%esp) is undefined. Similarly, if the constant operand did not have its high bit set, then the SF would become 0 regardless of 8(%esp) being undefined. The definedness of each bit of %eflags must be tracked separately, or bugs such as this probably will arise for a long time. -- |