qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/3] target-mips: Copy restrictions from ext/


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 1/3] target-mips: Copy restrictions from ext/ins to dext/dins
Date: Mon, 3 Aug 2015 14:41:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/03/2015 02:31 PM, Aurelien Jarno wrote:
On 2015-08-03 12:35, Richard Henderson wrote:
          if (msb != 31) {
-            tcg_gen_andi_tl(t0, t0, (1 << (msb + 1)) - 1);
+            tcg_gen_andi_tl(t0, t0, (1U << (msb + 1)) - 1);

Is this change really needed?

msb == 30 means 1 << 31. Which officially must be unsigned to be correct. If we were to run under ubsan, this would trigger an error.

Note that DEXT can't fail as both lsb and msb are in the range 0..31.
DEXTU and DEXTM can.
...
The same way DINSM can't fail.

Yes, I know. But it seems cleaner to do the checks always, unifying all of the code.

Should we try to get this one into 2.4, if not already too late?

Perhaps.  Otherwise via stable after the fact.


r~




reply via email to

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