poke-devel
[Top][All Lists]
Advanced

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

Re: integer overflow in muli instruction


From: Bruno Haible
Subject: Re: integer overflow in muli instruction
Date: Tue, 23 Feb 2021 20:21:38 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-201-generic; KDE/5.18.0; x86_64; ; )

Jose E. Marchesi wrote:
> So I think at this point we are good when it comes to detecting overflow
> in signed operations.

There is a problem, though: A literal that was printed cannot be parsed
when viewed as an expression:

(poke) .set obase 10
(poke) -2*0x4000000000000000
-9223372036854775808L
(poke) -9223372036854775808L
<stdin>:1:1: error: expression overflows
-9223372036854775808L;
^

What's odd is that this works in base 16:

(poke) .set obase 16
(poke) -2*0x4000000000000000
0x8000000000000000L
(poke) 0x8000000000000000L
0x8000000000000000L

Apparently because in base 16, signed integers are printed as if they were
unsigned. (Not sure whether this is intentional?)

Bruno




reply via email to

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