--- gcd_ui.c.~1.10.~	2002-05-23 11:50:20.000000000 +1000
+++ gcd_ui.c	2003-04-06 16:08:18.000000000 +1000
@@ -58,8 +58,9 @@
 	    }
 	  SIZ(w) = un;
 	}
-      /* We can't return any useful result for gcd(big,0).  */
-      return un > 1 ? 0 : PTR(u)[0];
+      /* Return u if it fits a ulong, otherwise 0. */
+      res = PTR(u)[0];
+      return (un == 1 && res <= ULONG_MAX ? res : 0);
     }
   else
     res = mpn_gcd_1 (PTR(u), un, (mp_limb_t) v);
