diff mbox

Go patch committed: Fix export of complex constants with 0 imaginary part

Message ID CAOyqgcXRRE7nNkXxrHqYaAsuUM-KJmfL2E-fh2+qCmBX4DGcwA@mail.gmail.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 7, 2015, 12:15 a.m. UTC
This patch by Chris Manghane fixes the export data for complex
constants with a zero imaginary part.  This is
https://code.google.com/p/gofrontend/issues/detail?id=31 .
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian
diff mbox

Patch

diff -r fd1c78fac62c go/expressions.cc
--- a/go/expressions.cc	Tue Jan 06 15:21:38 2015 -0800
+++ b/go/expressions.cc	Tue Jan 06 16:12:09 2015 -0800
@@ -2450,7 +2450,7 @@ 
   if (!mpfr_zero_p(mpc_realref(val)))
     {
       Float_expression::export_float(exp, mpc_realref(val));
-      if (mpfr_sgn(mpc_imagref(val)) > 0)
+      if (mpfr_sgn(mpc_imagref(val)) >= 0)
 	exp->write_c_string("+");
     }
   Float_expression::export_float(exp, mpc_imagref(val));