Bug in mpq_canonicalize in Mac OS 10.7?

Ronald Bruck rbruck at gmail.com
Tue Aug 30 06:44:23 CEST 2011

I'd be interested in the results of other Mac OS 10.7 ("Lion") users who compile and run the following:

#include <stdio.h>
#include <gmp.h>

int main()
  mpq_t qx;

  mpq_init (qx);
  mpq_set_str (qx, "537/238", 10);
  gmp_printf ("qx = %Qd\n", qx);
  mpq_canonicalize (qx);                               <<---------- Hangs here!
  gmp_printf ("qx = %Qd\n", qx);

I compiled it with

  icc -o test test.c -lgmp

It hangs in mpq_canonicalize.  This does NOT happen on my Linux box, but is completely reproducible on my laptop and my
Mac Pro.  I conjecture it's just another incompatibility with OS X.

My GMP is 5.02.  It passed the "make check" tests.  I also tried installing MacPorts' version, and for the life of me I don't know which
is the active version now.  But it doesn't work, and in a VERY subtle way.  I haven't tried yet, but there are not many numbers
where this fails.

Any suggestions?  I **was** delighted that I finally had my GMP apps working multi-platform.  I have a talk coming up in September,
and was going to use my Mac laptop for the presentation.  (Whatever else you may think of Apple, their user interface compared to
X-11 is just wonderful.  The mouse works; the trackpad is SUPERB; the cursor works with Mathematica; just the simple things in
life which are so klutzy in Linux.)

Any ideas?

-- Ron Bruck

More information about the gmp-bugs mailing list