aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/expressions.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-04-23 20:49:33 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-04-23 20:49:33 +0000
commit073d123ccf7036f9b103cc73f1a9b1bc3dd90d3b (patch)
tree213d40270439ed5c8a2ea5403144f48de13eea76 /gcc/go/gofrontend/expressions.cc
parent24fc7360e5be54d73e677e6fe59339f58035e67a (diff)
downloadgcc-073d123ccf7036f9b103cc73f1a9b1bc3dd90d3b.zip
gcc-073d123ccf7036f9b103cc73f1a9b1bc3dd90d3b.tar.gz
gcc-073d123ccf7036f9b103cc73f1a9b1bc3dd90d3b.tar.bz2
compiler: Correct handling of negative zero floating constant.
From-SVN: r186722
Diffstat (limited to 'gcc/go/gofrontend/expressions.cc')
-rw-r--r--gcc/go/gofrontend/expressions.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index cb94e4f..945f379 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -13620,7 +13620,13 @@ Numeric_constant::set_float(Type* type, const mpfr_t val)
this->clear();
this->classification_ = NC_FLOAT;
this->type_ = type;
- mpfr_init_set(this->u_.float_val, val, GMP_RNDN);
+ // Numeric constants do not have negative zero values, so remove
+ // them here. They also don't have infinity or NaN values, but we
+ // should never see them here.
+ if (mpfr_zero_p(val))
+ mpfr_init_set_ui(this->u_.float_val, 0, GMP_RNDN);
+ else
+ mpfr_init_set(this->u_.float_val, val, GMP_RNDN);
}
// Set to a complex value.