This service will be undergoing maintenance at 20:00 UTC, 2017-04-03. It is expected to last about 30 minutes
Bug 25515 - gmp is misconfigured as 32-bit
gmp is misconfigured as 32-bit
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gmp (Show other bugs)
7.0
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-02-01 14:54 EST by Richard Fish
Modified: 2015-03-04 20:08 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-01 14:54:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard Fish 2001-02-01 14:54:34 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.74 [en] (X11; U; Linux 2.2.17 i686)


libgmp is misconfigured to believe it is on a 32-bit system.  This causes a
segfault when creating mp numbers larger than about 96-bits.

Reproducible: Always
Steps to Reproduce:
Run the following python script:

#!/usr/bin/python
import mpz
import string
import sys

hexpriv =
"34105BD57E01AE0AF358F168D70FF31015203A3E7FAD31A3AE75223D251E5453AAC620417EB3DE2CB7767DEDDBE855D281F2D5DE548BE19A14FE9A0E583F60CFC0E3A30500B5AF8B806F621462A2258987E7AA15A5265DF3901EA6C9C9CB3BEEB8E7EA872322986618BAD0751BC051140A5C3561F59D8FE3ABD36CAF1CF4F1AC"

# first, a creation test
for i in range(4, len(hexpriv) + 1, 2):
    # we do this twice because memory corruption on the first
    # conversion may not appear until the second one.
    sys.stderr.write("\rConverting %d-bit..." % (i * 4));
    sys.stderr.flush()
    longval = string.atol(hexpriv[:i], 16)
    v = mpz.mpz(longval)
    sys.stderr.write("SUCCESS. Again..."); sys.stderr.flush()
    v = mpz.mpz(longval)
    sys.stderr.write("SUCCESS!"); sys.stderr.flush()
pass

sys.stderr.write("\n"); sys.stderr.flush()
	

Actual Results:  The above program generates segfaults around 96-104 bits

To fix, get the gmp-3.1.1 source.  Apply this patch, and compile.

diff -urN gmp-3.1.1-orig/longlong.h gmp-3.1.1/longlong.h
--- gmp-3.1.1-orig/longlong.h   Mon Jul 24 10:04:09 2000
+++ gmp-3.1.1/longlong.h        Thu Feb  1 11:13:02 2001
@@ -157,14 +157,14 @@
 #endif /* LONGLONG_STANDALONE */
 #endif /* hppa */
 
-#if defined (__ia64) && W_TYPE_SIZE == 64
+#if defined (__ia64) && !defined(NO_ASM) && W_TYPE_SIZE == 64
 #if defined (__GNUC__)
 #define umul_ppmm(ph, pl, m0, m1) \
   do {                                                                 \
     UDItype __m0 = (m0), __m1 = (m1);                                  \
     __asm__ ("xma.hu %0 = %1, %2, f0"                                  \
-            : "=e" (ph)                                                \
-            : "e" (m0), "e" (m1));                                     \
+            : "=f" (ph)                                                \
+            : "f" (m0), "f" (m1));                                     \
     (pl) = __m0 *
__m1;                                                        \
   } while (0)
 #endif
diff -urN gmp-3.1.1-orig/mpn/generic/gmp-mparam.h
gmp-3.1.1/mpn/generic/gmp-mparam.h
--- gmp-3.1.1-orig/mpn/generic/gmp-mparam.h     Mon Jul 24 10:04:22 2000
+++ gmp-3.1.1/mpn/generic/gmp-mparam.h  Thu Feb  1 09:44:34 2001
@@ -19,9 +19,9 @@
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 MA 02111-1307, USA. */
 
-#define BITS_PER_MP_LIMB 32
-#define BYTES_PER_MP_LIMB 4
-#define BITS_PER_LONGINT 32
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+#define BITS_PER_LONGINT 64
 #define BITS_PER_INT 32
 #define BITS_PER_SHORTINT 16
 #define BITS_PER_CHAR 8
Comment 1 Phil Knirsch 2001-02-05 10:04:52 EST
Checked it and found that it breaks for other gmp programs as well on IA64.
Tested patch, works and looks sane so i'll include it in the next build.

Read ya, Phil
Comment 2 Phil Knirsch 2001-02-05 10:32:19 EST
I've actually changes the patch to do the right thing: Instead of modifying the
generic header file there is now a new ia64 subdirectory which contains the
correct header file so that this patch might even make it into the real gmp
distribution.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.