illegal instruction error with "get_d"

edA-qa mort-ora-y eda-qa at disemia.com
Tue Apr 1 09:18:15 UTC 2014


I created a simple example in C and it didn't happen. But then the
strangest thing, I tried the C++ sample again and it also didn't happen.
The only difference is that I rebooted the machine. Perhaps there's an
error in the way Arch linux is handling it's shared libraries.

In any case, I don't think there's much that can be done now.

On 31/03/14 17:21, Niels Möller wrote:
> 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
> 


-- 
edA-qa mort-ora-y
http://mortoray.com/

Leaf - the language we always wanted
http://leaflang.org/


More information about the gmp-bugs mailing list