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

Vincent Lefevre vincent at
Thu Mar 28 17:24:43 UTC 2019

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

gives the following error:

cventin:~> ./tst
Uninitialized bytes in __interceptor_puts at offset 1 inside [0x701000000010, 2)
==17647==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7fbf03e6fe6a in __gmpz_dump (/usr/lib/x86_64-linux-gnu/
    #1 0x49518a in main (/home/vlefevre/tst+0x49518a)
    #2 0x7fbf03aeb09a in __libc_start_main (/lib/x86_64-linux-gnu/
    #3 0x41e2b9 in _start (/home/vlefevre/tst+0x41e2b9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/usr/lib/x86_64-linux-gnu/ in __gmpz_dump
zsh: exit 77    ./tst

Vincent Lefèvre <vincent at> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-bugs mailing list