Subject: Re: bug#13030: factor: infinite loop on Linux/powerpc

From: Pádraig Brady <[email-masked]>
Date: Thu, 29 Nov 2012 20:08:43 +0000

On 11/29/2012 07:36 PM, Torbjorn Granlund wrote:
> Pádraig Brady <[email-masked]> writes:
>
>    > -#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.  */
>    >
>    > Thanks,
>    >
>
> I suppose it might be much better to make W_TYPE_SIZE not be set to a
> size not supported by the present ABI.
>
> That way, we will avoid longlong.h divergence.

So that's a bit in contradiction to:
http://bugs.gnu.org/12754#20

So you're suggesting that this would be safest?

diff --git a/src/factor.c b/src/factor.c
index 6d1d17a..d2a4158 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -126,11 +126,11 @@
  /* Make definitions for longlong.h to make it do what it can do for us */

  /* bitcount for uintmax_t */
-# if UINTMAX_MAX == UINT32_MAX
+# if ULONG_MAX == UINT32_MAX
  #  define W_TYPE_SIZE 32
-# elif UINTMAX_MAX == UINT64_MAX
+# elif ULONG_MAX == UINT64_MAX
  #  define W_TYPE_SIZE 64
-# elif UINTMAX_MAX == UINT128_MAX
+# elif ULONG_MAX == UINT128_MAX
  #  define W_TYPE_SIZE 128
  # endif

In this particular case that would enable
the 32 bit ppc assembly in longlong.h

thanks,
Pádraig.