Bug in mpq_canonicalize in Mac OS 10.7?

Marc Glisse marc.glisse at inria.fr
Tue Aug 30 10:41:12 CEST 2011

On Mon, 29 Aug 2011, Ronald Bruck wrote:

> #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);
> }

It is likely a compiler bug, but where exactly does it hang? (you can 
attach a debugger to find out) mpq_canonicalize computes a gcd which 
mostly just forwards to hand-written asm in this small case. You can also 
try to follow the code with the debugger, except for the asm function, the 
rest should be fairly easy to understand. And then you'll have something 
to report to your compiler vendor...

> I compiled it with
>  icc -o test test.c -lgmp

Was the library also compiled with icc?

Btw, you forgot some of the info listed in:

Marc Glisse

More information about the gmp-bugs mailing list