git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.o
But with this patch, you're certainly on the right track. Thanks.

Cheers, Øyvind

Previous: René ScharfeNext: René Scharfe
Message 6 of 11 in “tr/xdiff-fast-hash generates warnings and breaks tests”
  1. Øyvind A. HolmMay 16, 2012
  2. René ScharfeMay 17, 2012
  3. Øyvind A. HolmMay 17, 2012
  4. Junio C HamanoMay 17, 2012
  5. René ScharfeMay 17, 2012
  6. Øyvind A. HolmMay 19, 2012
  7. 1/3 xdiff: avoid compiler warnings with XDL_FAST_HASH on 32-bit machinesRené Scharfe, May 22, 2012
  8. 2/3 xdiff: avoid more compiler warnings with XDL_FAST_HASH on 32-bit machinesRené Scharfe, May 22, 2012
  9. Thomas RastMay 23, 2012
  10. 3/3 xdiff: import new 32-bit version of count_masked_bytes()René Scharfe, May 22, 2012
  11. Øyvind A. HolmMay 25, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.