Signed-off-by: Jose E. Marchesi <[email protected]>
gcc/algol68/ChangeLog
* a68-low-units.cc (a68_lower_denotation): strtoul can return
errno /= 0 in overflow.
gcc/testsuite/ChangeLog
* algol68/compile/error-bits-denotation-1.a68: Test for overflow
of bits and long bits.
---
gcc/algol68/a68-low-units.cc | 3 +--
gcc/testsuite/algol68/compile/error-bits-denotation-1.a68 | 5 +++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gcc/algol68/a68-low-units.cc b/gcc/algol68/a68-low-units.cc
index ed92a1fd517..ac7accd9051 100644
--- a/gcc/algol68/a68-low-units.cc
+++ b/gcc/algol68/a68-low-units.cc
@@ -301,8 +301,7 @@ a68_lower_denotation (NODE_T *p, LOW_CTX_T ctx)
#else
uint64_t val = strtoull (end, &end, radix);
#endif
- gcc_assert (errno == 0 && end[0] == '\0');
-
+ gcc_assert (end[0] == '\0');
uint64_t max_positive = uint64_t (wi::max_value (type).to_uhwi ());
if (errno == ERANGE || val > max_positive)
{
diff --git a/gcc/testsuite/algol68/compile/error-bits-denotation-1.a68
b/gcc/testsuite/algol68/compile/error-bits-denotation-1.a68
index 455007c2905..75bf07bf3b0 100644
--- a/gcc/testsuite/algol68/compile/error-bits-denotation-1.a68
+++ b/gcc/testsuite/algol68/compile/error-bits-denotation-1.a68
@@ -2,5 +2,10 @@ begin short short bits a
= short short 10r256; { dg-error "denotation is too large for
short short bits" }
short bits b
= short 16rffff1; { dg-error "denotation is too large for short
bits" }
+ bits c
+ = 16rffffffff1; { dg-error "denotation is too large for bits" }
+ long bits d
+ = long 16rffffffffffffffff1; { dg-error "denotation is too large
for long bits" }
+
skip
end
--
2.39.5