Patchwork Go patch committed: Don't crash calling make with NaN or Infinity.

login
register
mail settings
Submitter Ian Taylor
Date March 3, 2011, 6:18 a.m.
Message ID <mcrfwr43ewe.fsf@google.com>
Download mbox | patch
Permalink /patch/85234/
State New
Headers show

Comments

Ian Taylor - March 3, 2011, 6:18 a.m.
This patch to the Go frontend avoids crashing if the predeclared make
function is called with a size which is NaN or Infinity.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

Patch

diff -r e973d2893617 go/types.cc
--- a/go/types.cc	Wed Mar 02 20:26:39 2011 -0800
+++ b/go/types.cc	Wed Mar 02 22:15:05 2011 -0800
@@ -769,7 +769,7 @@ 
   mpfr_init(fval);
 
   Type* dummy;
-  if (e->float_constant_value(fval, &dummy))
+  if (e->float_constant_value(fval, &dummy) && mpfr_integer_p(fval))
     {
       mpz_t ival;
       mpz_init(ival);