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

Niels Möller nisse at lysator.liu.se
Thu Mar 28 18:16:06 UTC 2019


Vincent Lefevre <vincent at vinc17.net> writes:

> On my Debian/unstable x86_64 machine (with GMP 6.1.2):
>
> #include <gmp.h>
>
> int main (void)
> {
>   mpz_t z;
>
>   mpz_init (z);
>   mpz_set_ui (z, 1);
>   mpz_dump (z);
>   mpz_clear (z);
>
>   return 0;
> }
>
> compiled with: clang-7 -fsanitize=memory -o tst tst.c -lgmp

Is -fsanitize=memory reliable when the C compiler doesn't get to see all
the source files? Do you get the same result of you recompile gmp using
CC='clang-7 -fsanitize=memory'? If you also recompile with
--disable-assembly?

For what it's worth, when I compile the same program and run it under
valgrind, I see no complaints. Also a debian x86_64 system with
gmp-6.1.2.

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