summaryrefslogtreecommitdiff
path: root/test-suite/tests
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2021-11-04 14:52:21 +0100
committerDaniel Llorens <lloda@sarc.name>2021-11-05 10:26:43 +0100
commitbf9d30f3c3fd03cb37d604f1927e9ce5c699338b (patch)
treea69d13af304256fd260ee706dbd666d090ab647b /test-suite/tests
parentffb33fd66bba30f6a3e554be644fcaf269d39f05 (diff)
downloadguile-bf9d30f3c3fd03cb37d604f1927e9ce5c699338b.tar.gz
Limit the range of ash, round-ash count argument to INT32
This avoids gmp aborting e.g. with (ash 1 (expt 2 37)). The new limit is such that (ash 1 (expt 30)) is accepted but (ash 1 (expt 31)) throws. Fixes https://bugs.gnu.org/48150 * libguile/numbers.c (ash, round-ash): As stated. * test-suite/tests/numbers.test: Test a case known to make gmp abort before.
Diffstat (limited to 'test-suite/tests')
-rw-r--r--test-suite/tests/numbers.test5
1 files changed, 4 insertions, 1 deletions
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 8f644874d..51263f0ac 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -5466,7 +5466,10 @@
(ash-variant -1 (- (expt 2 1000))))
(pass-if-exception "Huge left shift of non-zero => numerical overflow"
exception:numerical-overflow
- (ash-variant 123 (expt 2 1000)))))
+ (ash-variant 123 (expt 2 1000)))
+ (pass-if-exception "Shift large enough to cause gmp abort in 3.0.7"
+ exception:numerical-overflow
+ (ash-variant 1 (expt 2 37)))))
(test-ash-variant 'ash ash floor #f)
(test-ash-variant 'round-ash round-ash round #t)