Re: tr/xdiff-fast-hash generates warnings and breaks tests
- From
Øyvind A. Holm <sunny@sunbase.org>
- Date
- May 19, 2012, 14:17 UTC
- Message-ID
- <CAA787rmJixvyKhubHXZCDVYc=DdVk8_vHsHF6bOsLQ_j=39bGw@mail.gmail.com>
- In-Reply-To
- <4FB5460C.10807@lsrfire.ath.cx>
On 17 May 2012 18:23, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes: > > On Ubuntu 12.04 x86, t0020 fails for me as well when I compile with > > XDL_FAST_HASH explicitly set (it's off by default). > > OK. So does that indicate at least breakage in the Makefile that > attempts to set XDL_FAST_HASH only on x86_64, mistakenly triggering on > Øyvind's x86 32-bit userland, or did Øyvind manually flipped the > feature on?
No, I haven't fiddled with any of those, only using standard ./configure and also verified by running make using the standard Makefile.
On 17 May 2012 20:40, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:
Show 23 quoted lines
> The following patch on top of master makes the compiler put a sarl in > my build, and "make -j4 XDL_FAST_HASH=1 test" passes. > > Øyvind, does this oneliner help in your case as well? > > Subject: xdiff: signed right shift for 32-bit case of XDL_FAST_HASH > [...] > xdiff/xutils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xdiff/xutils.c b/xdiff/xutils.c > index 1b3b471..29df57e 100644 > --- a/xdiff/xutils.c > +++ b/xdiff/xutils.c > @@ -311,7 +311,7 @@ static inline long count_masked_bytes(unsigned > * (a+b+1) gives us > * correct 0-3 bytemask count result > */ > - long a = (mask - 256) >> 23; > + long a = ((long)mask - 256) >> 23; > long b = mask & 1; > return a + b + 1; > }
Yes, applied your patch to current master (9de9681), and the whole test suite runs without errors. The compiler still generates the same warnings, though:
CC xdiff/xdiffi.o
CC xdiff/xprepare.o
CC xdiff/xutils.o
xdiff/xutils.c: In function ‘has_zero’:
xdiff/xutils.c:261: warning: integer constant is too large for ‘unsigned
long’ type
xdiff/xutils.c:261: warning: integer constant is too large for ‘unsigned
long’ type
xdiff/xutils.c: In function ‘count_masked_bytes’:
xdiff/xutils.c:273: warning: integer constant is too large for ‘long’
type
xdiff/xutils.c: In function ‘xdl_hash_record’:
xdiff/xutils.c:310: warning: integer constant is too large for ‘unsigned
long’ type
xdiff/xutils.c:326: warning: integer constant is too large for ‘unsigned
long’ type
CC xdiff/xemit.o
CC xdiff/xmerge.oBut with this patch, you're certainly on the right track. Thanks.
Cheers, Øyvind