[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suspicious warning in W64 build
From: |
Richard Copley |
Subject: |
Re: Suspicious warning in W64 build |
Date: |
Thu, 7 Sep 2017 20:50:08 +0100 |
On 7 September 2017 at 20:26, Paul Eggert <address@hidden> wrote:
> Eli Zaretskii wrote:
>>>
>>> 18446744065119617024 is 1<<64.
>>> The other number is (1<<64) - (1<<33) - (1<<2).
>>
>> Yes, I know. I just don't understand why GCC things that
>>
>> nglyphs * sizeof (WORD) * 2
>>
>> can have a value in this range. The type of nglyphs is 'int', and
>> sizeof(WORD) gives 2. So the range should be between 0 (or 4) and 4
>> times INT_MAX, which is nowhere near the values GCC displays.
>>
>
> If nglyphs is negative the first multiplication is done using unsigned
> arithmetic, which could result in huge results. Presumably GCC does not know
> that nglyphs must be nonnegative. Try putting an 'eassume (0 <= nglyphs);'
> before the line in question. That is, if you're sure that nglyphs is
> nonnegative: if you're not, GCC has found a real bug here.
That makes sense if GCC has deduced that there is a call which always
passes a negative number (though it would be even better if the
warning identified where such call(s) are).
But if it's possible to pass a small positive number for nglyphs at
all the call sites, then the range in the warning is certainly wrong.
Hmm, actually now I notice that A>B in the quoted range [A, B]. That's
not normal mathematical notation.
Is it a Computer Science thing for types that wrap? In that case I'm
not sure why a warning is merited.
Is it a Computer Science thing for types that wrap? In that case I'm
not sure why a warning is merited. Could it be a special GCC notation?
I rather suspect it's some mistake. But I'm probably missing
something, if Paul and the people on the GCC bug thread don't see an
issue.
- Re: Suspicious warning in W64 build, (continued)
- Re: Suspicious warning in W64 build, Angelo Graziosi, 2017/09/07
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/07
- Re: Suspicious warning in W64 build, Herring, Davis, 2017/09/09
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/09
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/09
- Re: Suspicious warning in W64 build, Angelo Graziosi, 2017/09/09
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/09
- Re: Suspicious warning in W64 build, Angelo Graziosi, 2017/09/09
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/07
- Re: Suspicious warning in W64 build, Paul Eggert, 2017/09/07
- Re: Suspicious warning in W64 build,
Richard Copley <=
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/07
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/08
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/08
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/08
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/08
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/08
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/08
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/09
- Re: Suspicious warning in W64 build, Richard Copley, 2017/09/08
- Re: Suspicious warning in W64 build, Eli Zaretskii, 2017/09/09