illegal instruction error with "get_d"

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

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

[gnome at localhost test]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
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=https://bugs.archlinux.org/
--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/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 ()


[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
version).

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