]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
factor: fix infinite loop on 32 bit powerpc
authorColin Watson <cjwatson@ubuntu.com>
Thu, 29 Nov 2012 19:37:30 +0000 (19:37 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 4 Dec 2012 12:28:42 +0000 (12:28 +0000)
Both Debian and Ubuntu builds of coreutils 8.20 hang while running the
test suite on powerpc, which is reproducible using 'factor 122'.

This turns out to be somewhat related to http://bugs.gnu.org/12754,
but not quite the same.  uintmax_t is 64 bits, but the cntlzw
instruction takes 32-bit operands, and the cntlzd option is only
available on 64-bit hardware.

* src/longlong.h: Add an _LP64 check around the PPC64 code,
so that this falls back to the C implementations.
* NEWS: Mention the fix.

NEWS
src/longlong.h

diff --git a/NEWS b/NEWS
index d4aebeb2134d0f589491945b31ab4cb4793dffe9..f04c5100e02e71e1338b50efab9dd117ef5f04aa 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ GNU coreutils NEWS                                    -*- outline -*-
   another range.  Before, "echo 123|cut --output-delim=: -b2-,3" would print
   "2:3".  Now it prints "23".  [bug introduced in 5.3.0]
 
+  factor no longer loops infinitely on 32 bit powerpc systems.
+  [bug introduced in coreutils-8.20]
+
   install -m M SOURCE DEST no longer has a race condition where DEST's
   permissions are temporarily derived from SOURCE instead of from M.
 
index 6ee157cda8e8927beab5e9599caaf320facff77d..f2b2c49857d88bc529a9576fa1e58e7e21b8c92c 100644 (file)
@@ -1398,7 +1398,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
 
 /* We should test _IBMR2 here when we add assembly support for the system
    vendor compilers.  */
-#if HAVE_HOST_CPU_FAMILY_powerpc && W_TYPE_SIZE == 64
+#if HAVE_HOST_CPU_FAMILY_powerpc && W_TYPE_SIZE == 64 && defined (_LP64)
 #if !defined (_LONG_LONG_LIMB)
 /* _LONG_LONG_LIMB is ABI=mode32 where adde operates on 32-bit values.  So
    use adde etc only when not _LONG_LONG_LIMB.  */