[Top][All Lists]

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

Re: [Tinycc-devel] Broken commit e460f7dbb216

From: grischka
Subject: Re: [Tinycc-devel] Broken commit e460f7dbb216
Date: Mon, 1 Aug 2022 14:13:09 +0200
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 30.07.2022 20:13, Vincent Lefevre wrote:
On 2022-07-30 19:48:29 +0200, grischka wrote:
Sorry, what?  Are you saying that (n & (n - 1)) with n == 1 -> (1 & 0)
and with n == 0 -> (0 & -1) does not evaluate to 0 in both cases always
necessarily, in C?

Yes, if the 0 happens to be a negative 0, 1 & 0 will give 1
in ones' complement, and 0 & -1 will also give non-zero in
both ones' complement and "sign and magnitude".

Okay, I was not thinking about that.  Still, nothing just "happens".

For example, 0 cannot "happen" to be a negative 0.  A negative 0
needs to be generated, for example using the complement operator ~0.

We need to be precise.  When we are considering two cases, 1 and 0
this clearly does not include a third case ~0.

What you maybe are trying to say is that we do not know whether
    n = expr_const();
could maybe return a negative zero on an imaginary platform.

However this is not about tcc, it is about our knowledge about tcc
pr the platform.   If we were interested we could update our knowledge
and then we would make sure that unexpected negative zeros can never

In conclusion I think we did prove that in both the existing as well
as the imaginary tcc, the additional "(n > 1 &&" clause is and will
remain redundant and unnecessary.

--- grischka

reply via email to

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