illegal instruction error with "get_d"

Niels Möller nisse at lysator.liu.se
Mon Mar 31 15:21:41 UTC 2014


edA-qa mort-ora-y <eda-qa at disemia.com> 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
directly?

> Program received signal SIGILL, Illegal instruction.
> 0x00007ffff7b9f70e in __gmpn_get_d () from /opt/gmp/install/lib/libgmp.so.10
> (gdb) back
> #0  0x00007ffff7b9f70e in __gmpn_get_d () from
> /opt/gmp/install/lib/libgmp.so.10
> #1  0x00007ffff7b8c63a in __gmpq_get_d () from
> /opt/gmp/install/lib/libgmp.so.10
> #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.

Regards,
/Niels

-- 
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