qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] sparc32 : Signed integer division overflow


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2] sparc32 : Signed integer division overflow
Date: Thu, 20 Mar 2014 09:15:40 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 03/19/2014 03:29 PM, Olivier Danet wrote:
> +        if ((int32_t) x0 != x0) {
> +            x0 = x0 < 0 ? 0x80000000 : 0x7fffffff;
> +            overflow = 1;
> +        }

Actually, there's an existing bug here that we might as well fix.

  ## ... the 32-bit result is sign-extended to 64 bits and
  ## written into register R[rd].

That 0x80000000 is not going to promote properly to 64-bits.  We might as well
go ahead and use INT32_MIN and INT32_MAX here at the same time.



r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]