GNU bug report logs - #12754
factor.c selects 64 bit code from longlong.h on 32-bit hppa systems

Previous Next

Package: coreutils;

Reported by: John David Anglin <dave.anglin <at> nrc-cnrc.gc.ca>

Date: Sun, 28 Oct 2012 19:50:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: John David Anglin <dave.anglin <at> nrc-cnrc.gc.ca>
Cc: 12754 <at> debbugs.gnu.org, John David Anglin <dave <at> hiauly1.hia.nrc.ca>
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
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




This bug report was last modified 12 years and 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.