[PATCH] acinclude.m4: fix test for long long

Torbjorn Granlund tg at gmplib.org
Thu Dec 3 23:01:04 CET 2009


Yann Droneaud <yann at droneaud.fr> writes:

  # HG changeset patch
  # User Yann Droneaud <yann at droneaud.fr>
  # Date 1259855155 18000
  # Node ID 16ccb7e260b910259abe22cb159a22fb32b22824
  # Parent  3081e11883a3f2169a893e4f224d046f1f8ac93f
  acinclude.m4: fix test for long long
  
  In test [long long reliability test 1], __inline__ is used regardless
  of the GCC mode, eg. C89 + GNU extensions or C99.
  When C99 is used, __inline__ semantics changes.
  It's especially a problem when GCC is not optimizing, thus not
  using __inline__ functions. In the end, the e() function is not emitted,
  and the linker is not able to found it. So the test failed.
  
  Fix this problem by adding "static". static inline behavor is the same
  regardless C89 + GNU extensions or C99.
  
  diff -r 3081e11883a3 -r 16ccb7e260b9 acinclude.m4
  --- a/acinclude.m4	Thu Dec 03 10:15:33 2009 -0500
  +++ b/acinclude.m4	Thu Dec 03 10:45:55 2009 -0500
  @@ -591,7 +591,7 @@
   
   #if defined (__GNUC__) && ! defined (__cplusplus)
   typedef unsigned long long t1;typedef t1*t2;
  -__inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
  +static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
   {t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
   f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
   for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}

Thanks, I committed this change.

-- 
Torbjörn


More information about the gmp-devel mailing list