qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/3] int128.h: Avoid undefined be


From: Peter Maydell
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 2/3] int128.h: Avoid undefined behaviours involving signed arithmetic
Date: Mon, 7 Apr 2014 16:17:10 +0100

On 7 April 2014 15:56, Avi Kivity <address@hidden> wrote:
> On 04/06/2014 01:18 PM, Peter Maydell wrote:
>> The alternative would be to say that Int128 should have
>> undefined behaviour on underflow/overflow and the test
>> code is wrong, but that doesn't seem very useful to me.

> Isn't the test broken here?  It is trying to add (or shift) -2^127 and
> something else, and the result truly overflows.

Well, the test code is assuming "semantics as per 2s
complement arithmetic" and checking various corner cases.
As I say, we could define that this is invalid and
rewrite the test cases.

thanks
-- PMM



reply via email to

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