diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-15 21:52:23 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-18 15:56:20 -0800 |
commit | 5128f8d0d99008d4f069bbaef9ee4372fe5da7ce (patch) | |
tree | a350c80e42f75a90a6ae1196c99486b14df5c1f9 /gcc/go/gofrontend | |
parent | 0e9f2b2dc8df91be27acc383c63f0feae28fa229 (diff) | |
download | gcc-5128f8d0d99008d4f069bbaef9ee4372fe5da7ce.zip gcc-5128f8d0d99008d4f069bbaef9ee4372fe5da7ce.tar.gz gcc-5128f8d0d99008d4f069bbaef9ee4372fe5da7ce.tar.bz2 |
compiler: check for floating-point exponent overflow
Adjust mksysinfo and mkrsysinfo to strip out floating-point max numbers,
as they can trigger this error.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/278476
Diffstat (limited to 'gcc/go/gofrontend')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/lex.cc | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 6567db1..40242cc6 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -526037336231593939a517b7c0b2892d413adb40 +1317de50147304a226b3ec5c4d81376470c358e5 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index e71b8cd..0baf4e4 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -1316,9 +1316,13 @@ Lex::gather_number() } } + mpfr_clear_overflow(); mpfr_t val; int r = mpfr_init_set_str(val, num.c_str(), base, MPFR_RNDN); go_assert(r == 0); + if (mpfr_overflow_p()) + go_error_at(this->location(), + "floating-point exponent too large to represent"); bool is_imaginary = *p == 'i'; if (is_imaginary) |