From: Richard Henderson <rth@twiddle.net>
To: Olivier Danet <odanet@caramail.com>,
qemu-devel <qemu-devel@nongnu.org>,
Blue Swirl <blauwirbel@gmail.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: Re: [Qemu-devel] [PATCH v2] sparc32 : Signed integer division overflow
Date: Thu, 20 Mar 2014 09:15:40 -0700 [thread overview]
Message-ID: <532B142C.9060800@twiddle.net> (raw)
In-Reply-To: <532A1A30.3040306@caramail.com>
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~
prev parent reply other threads:[~2014-03-20 16:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 22:29 [Qemu-devel] [PATCH v2] sparc32 : Signed integer division overflow Olivier Danet
2014-03-20 15:54 ` Richard Henderson
2014-03-20 16:15 ` Richard Henderson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532B142C.9060800@twiddle.net \
--to=rth@twiddle.net \
--cc=blauwirbel@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=odanet@caramail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).