make failure trying to build gmp-5.1.0a on Tru64unix v5.1b system

Niels Möller nisse at lysator.liu.se
Sat Feb 16 08:23:07 CET 2013


Bill.Glessner at cwu.EDU writes:

> apparently has issues with a form of 'assert' that is used in the
> ./mini-gmp/mini-gmp.c component. Specifically it appears that:
> an 'assert' containing an array reference such as 'dp[dn-1]'  or
> a conditional statement that does not contain an explicit relational 
> operator 'assert (dp[dn-1] & GMP_LIMB_HIGHBIT);' rather than 
> ''assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0);' do not evaluate/compile
> correctly.

Thanks for investigating. To you know how it is broken? Is the assert
macro broken (say, using too few parenthesis around the argument), or is
it a deeper compiler problem? What does the definition of assert look
like?

> The following changes in the ./mini-gmp.mini-gmp.c module allowed the
> Tru64unix 5.1B-6 C compiler to produce a result that continued the build:
>
> Replace
>
> /*  assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0); */
>
> With
>
>   mp_limb_t dpVAL;
>   dpVAL = dp[dn-1];
>   assert ((dpVAL & GMP_LIMB_HIGHBIT) != 0);

I really don't like adding extra variables just for use in the assert.
Maybe we can find a less ugly workaround? If not, one alternative might
be to simply disable asserts, something like

  #if some_true_64_compiler_predefine
  #define NDEBUG 1
  #endif
  
  #include <assert.h>

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list