From 3e12b42be93c14a599df9c96e58ba66cd864bf77 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 6 Feb 2018 15:30:06 +0000 Subject: compiler: avoid negative zero in float constants Check for negative numbers with very small magnitudes that will round to negative zero, and force them to positive zero instead. This implements the spec clarification in https://golang.org/cl/14727. The test is in https://golang.org/cl/91895. Fixes golang/go#12621 Reviewed-on: https://go-review.googlesource.com/92175 From-SVN: r257415 --- gcc/go/gofrontend/expressions.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/go/gofrontend/expressions.h') diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index d16a284..a58c79c 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -4220,6 +4220,9 @@ class Numeric_constant bool check_complex_type(Complex_type*, bool, Location); + static bool + is_float_neg_zero(const mpfr_t, int bits); + // The kinds of constants. enum Classification { -- cgit v1.1