summaryrefslogtreecommitdiff
path: root/src/factor.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-01-04 18:07:01 +0000
committerPádraig Brady <P@draigBrady.com>2013-01-07 02:11:36 +0000
commit05382299cd9953a32c95f89b7cdef6f512176a81 (patch)
tree40a19c7c44a2957345db313363e4425cc0b78f05 /src/factor.c
parent1248cc816ce61e61829b510ae6969cbf224ce300 (diff)
downloadcoreutils-05382299cd9953a32c95f89b7cdef6f512176a81.tar.xz
factor: apply a more general fix to enable correct assembly
In addition to the previous 64 bit guards we've placed in longlong.h there are additional _LP64 guards required for mips with -mcpu >= 3, to avoid a build failure (http://bugs.gnu.org/13353) and on sparc with -mcpu >= v9 in 32 bit mode where for example, `factor 2123123123123123123123` would go into an infinite loop. Since factor.c currently operates on uintmax_t, we restrict the use of the assembly in longlong.h to when 'long' has the same width, to provide a more general guard for this code. * src/factor.c: Restrict the use of longlong.h assembly code, to when the width of intmax_t == long. * src/longlong.h: Remove the previous _LP64 guards to avoid divergence from GMP's longlong.h * NEWS: Adjust the info on build and runtime fixes.
Diffstat (limited to 'src/factor.c')
-rw-r--r--src/factor.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/factor.c b/src/factor.c
index 473eee70d..95451a58d 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -118,7 +118,14 @@
#endif
#ifndef USE_LONGLONG_H
-# define USE_LONGLONG_H 1
+/* With the way we use longlong.h, it's only safe to use
+ when UWtype = UHWtype, as there were various cases
+ (as can be seen in the history for longlong.h) where
+ for example, _LP64 was required to enable W_TYPE_SIZE==64 code,
+ to avoid compile time or run time issues. */
+# if LONG_MAX == INTMAX_MAX
+# define USE_LONGLONG_H 1
+# endif
#endif
#if USE_LONGLONG_H