[Top][All Lists]

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

Re: Suspicious warning in W64 build

From: Paul Eggert
Subject: Re: Suspicious warning in W64 build
Date: Thu, 7 Sep 2017 12:26:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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.

reply via email to

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