bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12754: factor.c selects 64 bit code from longlong.h on 32-bit hppa s


From: Pádraig Brady
Subject: bug#12754: factor.c selects 64 bit code from longlong.h on 32-bit hppa systems
Date: Mon, 29 Oct 2012 02:26:58 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 10/28/2012 07:46 PM, John David Anglin wrote:
When USE_LONGLONG_H is defined, factor.c unilaterally defines W_TYPE_SIZE
to 64.  This selects the wrong code from longlong.h on 32-bit hppa systems
causing an assembly failure.

Attached is a hack which should work on most but probably not all systems.

This is closely related to the general solution I proposed
for http://bugs.gnu.org/12753#8
I.E. making the size of uintmax_t available to the preprocessor.
A particular size doesn't matter according to:
http://lists.gnu.org/archive/html/bug-coreutils/2012-09/msg00111.html

So I'll do something like the following.

thanks,
Pádraig.

diff --git a/src/factor.c b/src/factor.c
index 4c2af98..1b1b37f 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -124,7 +124,16 @@
 #if USE_LONGLONG_H

 /* Make definitions for longlong.h to make it do what it can do for us */
-# define W_TYPE_SIZE 64          /* bitcount for uintmax_t */
+
+/* bitcount for uintmax_t */
+#if UINTMAX_MAX == UINT32_MAX
+# define W_TYPE_SIZE 32
+#elif UINTMAX_MAX == UINT64_MAX
+# define W_TYPE_SIZE 64
+#elif UINTMAX_MAX == UINT128_MAX
+# define W_TYPE_SIZE 128
+#endif
+
 # define UWtype  uintmax_t
 # define UHWtype unsigned long int
 # undef UDWtype





reply via email to

[Prev in Thread] Current Thread [Next in Thread]