| Summary: | dev-libs/gmp-4.1.4 is broken for amd64 | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Andreas Pokorny <diemumiee> |
| Component: | New packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | apokorny, dragonheart |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | AMD64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: | failure.cpp | ||
uhm, want to fix it yourself? *g* This does not appear to be unique to amd64, that code segfaults on x86 Assigning to package maintainer, since this does not appear to be amd64 specific. Still a problem? I had to change the constant to 1099511627791ULL in the code to prevent a compile error. dan@frog ~ $ g++ failure.cpp -lgmp -lgmpxx -o failure dan@frog ~ $ ./failure m_p is now 111 m_p is now 438268538590035726067581115327087342094765875085367552470940927814798831211089489304915274322875259305984 m_p is now 111 m_p is now 13066230545009234931899163930418822401899199274150838281346798221339086364947911849315251938139628322516574175232 dan@frog ~ $ env ACCEPT_KEYWORDS=~x86 emerge -pv gmp mpfr These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] dev-libs/gmp-4.1.4-r3 USE="-doc -nocxx" 0 kB [ebuild R ] dev-libs/mpfr-2.2.0_p8 0 kB Total size of downloads: 0 kB dan@frog ~ $ emerge info Portage 2.1_pre4-r1 (!/home/dan/gentoo/gentoo-x86/profiles/hardened/x86/2.6, gcc-3.4.5, glibc-2.3.5-r2, 2.6.14-gentoo-r5 i686) ================================================================= System uname: 2.6.14-gentoo-r5 i686 AMD Athlon(tm) Gentoo Base System version 1.12.0_pre15 distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.3 [disabled] dev-lang/python: 2.3.5-r2, 2.4.2 sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1-r1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r3 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-march=athlon-xp -O2 -pipe" CHOST="i686-pc-linux-gnu" I'm thinking this was fixed in _p8 http://www.mpfr.org/mpfr-current/ Created attachment 79111 [details]
failure.cpp
I tested just for kicks, and version 4.1.4-r3 emerged fine on my amd64 system. see Bug 121968. Andreas does it work for you? This looks fine now. Please reopen if it is still a problem. |
the gmp library behves strange in several functions. The general adding substracting of large numbers works fine. But for example the function mpz_powm_ui (mpz_t rop, mpz_t base, unsigned long int exp, mpz_t mod); which calculates the base raised by exp, modulo mod, fails. Here is a small test case, that shows that the function fails, depending on the parameters: #include <iostream> #include <gmpxx.h> using namespace std; int main() { mpz_class val =29813298; { mpz_class m_p ("111"); cout << "m_p is now " << m_p << endl; mpz_pow_ui ( m_p.get_mpz_t(), val.get_mpz_t(), 14 ); cout << "m_p is now " << m_p << endl; } { mpz_class m_p ("111"); cout << "m_p is now " << m_p << endl; mpz_pow_ui( m_p.get_mpz_t(), val.get_mpz_t(), 1099511627791 ); cout << "m_p is now " << m_p << endl; } } Reproducible: Always Steps to Reproduce: 1.emerge gmp ( on amd64 ) 2.g++ failure.cpp -lgmp -lgmpxx -o failure 3../failure Actual Results: m_p is now 111 m_p is now 438268538590035726067581115327087342094765875085367552470940927814798831211089489304915274322875259305984 m_p is now 111 GNU MP: Cannot reallocate memory (old_size=16 new_size=80) Aborted Even if m_p gets a number large enough to store the result, the following call will fail. since gmp still tries to reallocate.