Exception access violation on Windows

Simon Byrne simonbyrne at gmail.com
Fri Jun 9 07:15:46 CEST 2023


A Julia user was able to trigger an exception access violation from
mpz_pow_ui by raising 10 to the power of 10^9. Unfortunately I don't
have access to a Windows machine to create a reproducer. I'm not sure
of the cause, but I will note that 10^9 is getting very close to the
maximum value of a long on Windows.

See https://github.com/JuliaLang/julia/issues/49580 for more details.

A C reproducer would be something like

#include "gmp.h"
#include <stdio.h>

int main(int argc, char * argv[]){
  mpz_t base, result;

  mpz_init_set_ui(base, 10);
  mpz_init(result);
  mpz_pow_ui(result, base, 1000000000);

  mpz_out_str(stdout,10,result);

  return 0;
}


(as noted above, I haven't tried running this on Windows, and on Linux
it appears to run but I didn't have the patience to see if it
completed).


More information about the gmp-bugs mailing list