failure with Clang's memory sanitizer: use-of-uninitialized-value

Niels Möller nisse at lysator.liu.se
Fri Mar 29 05:20:31 UTC 2019


Marc Glisse <marc.glisse at inria.fr> writes:

> Just recompiling GMP with CC='clang-7 -fsanitize=memory' (and
> --disable-shared) gives the more specific
>
> ==28897==WARNING: MemorySanitizer: use-of-uninitialized-value
>     #0 0x498856 in mpn_bc_get_str /tmp/g/mpn/get_str.c:239:7

Looks like the branch on rp[1] here,

      ul = rp[1];      
      while (ul != 0)  // <---

rp[1] appears initialized with

      MPN_COPY (rp + 1, up, un);

A bit unobvious what MPN_COPY expands to, but possibly some assembly
that the clang analyzer can't reason about? Since the result of the
function is as expected, it seems unlikely that ul doesn't hold the
proper input value.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list