illegal instruction error with "get_d"

Niels Möller nisse at
Mon Mar 31 15:21:41 UTC 2014

edA-qa mort-ora-y <eda-qa at> writes:

> `get_d` is causing an illegal instruction error on ArchLinux (current
> 64bit install). The reproduction is this simple program <gmp.cpp>:
> 	#include <iostream>
> 	#include <gmpxx.h>
> 	int main() {
> 		mpq_class value(1);
> 		std::cout << value.get_d() << std::endl;
> 	}

Can you find an example not involving C++, ideally calling mpn_get_d

> Program received signal SIGILL, Illegal instruction.
> 0x00007ffff7b9f70e in __gmpn_get_d () from /opt/gmp/install/lib/
> (gdb) back
> #0  0x00007ffff7b9f70e in __gmpn_get_d () from
> /opt/gmp/install/lib/
> #1  0x00007ffff7b8c63a in __gmpq_get_d () from
> /opt/gmp/install/lib/
> #2  0x0000000000400cc4 in __gmp_expr<__mpq_struct [1], __mpq_struct
> [1]>::get_d() const ()
> #3  0x0000000000400b23 in main ()

mpn_get_d (aka __gmpn_get_d) is a C function in GMP. You'd have to
examine the assembly code generated by the compiler, and first figure
out which instruction generates the SIGILL. It could be either compiler
bug, or the GMP code using some kind of undefined behaviour.


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

More information about the gmp-bugs mailing list