Re: tr/xdiff-fast-hash generates warnings and breaks tests

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

 



On 17 May 2012 18:23, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx> wrote:
> 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.o

But with this patch, you're certainly on the right track. Thanks.

Cheers,
Øyvind
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]