From 78138b65dc8f0f6f42f9bb9161396946377b3042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 30 Dec 2019 21:58:52 +0100 Subject: [PATCH 1/2] tests: add regression test for 547 Also add complex tests to the make-check test suite. that was a clear omission. --- src/c/numbers/expt.d | 1 + src/tests/ecl-tests.lisp | 9 ++++----- src/tests/normal-tests/complex.lsp | 13 ++++++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/c/numbers/expt.d b/src/c/numbers/expt.d index 1f206f99d..e18d86e5c 100644 --- a/src/c/numbers/expt.d +++ b/src/c/numbers/expt.d @@ -180,6 +180,7 @@ ecl_expt(cl_object x, cl_object y) /* rational ^ integer -> rational */ /* complex ^ integer -> complex/rational */ /* float ^ integer -> float */ + /* cfloat ^ integer -> cfloat */ /* ----------------------------------SECOND IF--- */ /* number ^ complex -> cfloat */ /* complex ^ number -> cfloat */ diff --git a/src/tests/ecl-tests.lisp b/src/tests/ecl-tests.lisp index cccf9751c..8863eed5b 100644 --- a/src/tests/ecl-tests.lisp +++ b/src/tests/ecl-tests.lisp @@ -20,13 +20,12 @@ ;;;; Declare the suites -(suite 'ecl-tests - '(executable ieee-fp eprocess package-ext hash-tables ansi+ mixed - cmp emb ffi mop mp run-program eformat complex)) - (suite 'make-check '(executable ieee-fp eprocess package-ext hash-tables ansi+ mixed - cmp emb ffi mop run-program mp)) + cmp emb ffi mop run-program mp complex)) + +(suite 'ecl-tests + '(make-check eformat)) (suite 'stress) (test stress.all (finishes (1am-ecl:run))) diff --git a/src/tests/normal-tests/complex.lsp b/src/tests/normal-tests/complex.lsp index 95851387a..d5519178d 100644 --- a/src/tests/normal-tests/complex.lsp +++ b/src/tests/normal-tests/complex.lsp @@ -288,4 +288,15 @@ (is (typep #c(1.0 0) 'si:complex-float)) (is (not (typep #c(1 1) 'si:complex-float))) (is (not (typep #c(0 1) 'si:complex-float))) - (is (not (typep #c(1 0) 'si:complex-float))))) + (is (not (typep #c(1 0) 'si:complex-float)))) + + ;; Date: 2019-12-30 + ;; URL: https://gitlab.com/embeddable-common-lisp/ecl/issues/547 + ;; From: Karsten Poeck + ;; Fixed: 2019-12-30 (Daniel KochmaƄski) + ;; Description: + ;; + ;; (EXPT #C(1.0 0.0) 2) causes unrecoverable error. + ;; + (test.csfloat.0010.issue-547 + (finishes (expt #c(1.0 0.0) 2)))) From bbd3c2d6d0d1cbe0d29e3f9e28130f90fe4d03cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Mon, 30 Dec 2019 22:00:14 +0100 Subject: [PATCH 2/2] expt: add a case for complex-float ^ integer. Lack of this switch branch lead to unrecoverable error. Fixes #547. --- src/c/numbers/expt.d | 6 ++++++ src/tests/normal-tests/complex.lsp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/c/numbers/expt.d b/src/c/numbers/expt.d index e18d86e5c..d35817df5 100644 --- a/src/c/numbers/expt.d +++ b/src/c/numbers/expt.d @@ -202,6 +202,12 @@ ecl_expt(cl_object x, cl_object y) case t_doublefloat: case t_singlefloat: return ecl_expt_float(x, y); +#ifdef ECL_COMPLEX_FLOAT + case t_clfloat: + case t_cdfloat: + case t_csfloat: + return ecl_expt_complex_float(x, y); +#endif default: ecl_internal_error("expt: unhandled switch branch."); } diff --git a/src/tests/normal-tests/complex.lsp b/src/tests/normal-tests/complex.lsp index d5519178d..fe716cd5f 100644 --- a/src/tests/normal-tests/complex.lsp +++ b/src/tests/normal-tests/complex.lsp @@ -298,5 +298,5 @@ ;; ;; (EXPT #C(1.0 0.0) 2) causes unrecoverable error. ;; - (test.csfloat.0010.issue-547 + (test csfloat.0010.issue-547 (finishes (expt #c(1.0 0.0) 2))))