illegal instruction error with "get_d"

edA-qa mort-ora-y eda-qa at
Mon Mar 31 06:53:07 UTC 2014

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

gmplib 6.0.0 (5.1.2 also had the issue)
I've compiled from source:
	./configure --prefix=/opt/gmp/install --enable-cxx
	make install

To ensure no system libraries are used when I compile I used this
	g++ -o /tmp/gmp gmp.cpp /opt/gmp/install/lib/
Running `/tmp/gmp` causes an illegal instruction.

[gnome at localhost test]$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20140206/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-cloog-backend=isl
--disable-cloog-version-check --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.2 20140206 (prerelease) (GCC)

GDB Backtrace:

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
#1  0x00007ffff7b8c63a in __gmpq_get_d () from
#2  0x0000000000400cc4 in __gmp_expr<__mpq_struct [1], __mpq_struct
[1]>::get_d() const ()
#3  0x0000000000400b23 in main ()

[gnome at localhost test]$ uname -a
Linux localhost 3.13.7-1-ARCH #1 SMP PREEMPT Mon Mar 24 20:06:08 CET
2014 x86_64 GNU/Linux

VirtualBox: This host is running inside VirtualBox on a Ubuntu 12.04
host. GMP works fine on the host (the biggest difference is the GCC

edA-qa mort-ora-y

Leaf - the language we always wanted

More information about the gmp-bugs mailing list