[Git][cmucl/cmucl][issue-468-core-math-signals] 7 commits: Define macros to handle invalid and overflow signals
Raymond Toy pushed to branch issue-468-core-math-signals at cmucl / cmucl Commits: 3fa81f34 by Raymond Toy at 2026-02-03T08:32:45-08:00 Define macros to handle invalid and overflow signals - - - - - 9a4f3d7e by Raymond Toy at 2026-02-04T08:06:20-08:00 Minor cleanup of GNUMakefile First, CORE64_OBJS is no longer defined, so don't use it. The CORE64_OBJS that used to name the .o files for core-math are now computed as part of OBJS. This removal also meant that the "clean" target no longer removed the core-math object files. Fix this by changing the rule to remove $(OBJS) instead of *.o. - - - - - f5a798b8 by Raymond Toy at 2026-02-05T17:51:48-08:00 Fix #470: Fix unit test issues on Ubuntu CI - - - - - 5b6d4d73 by Raymond Toy at 2026-02-05T17:51:48-08:00 Merge branch 'issue-470-ubuntu-ci-failures' into 'master' Fix #470: Fix unit test issues on Ubuntu CI Closes #470 See merge request cmucl/cmucl!348 - - - - - 772641b9 by Raymond Toy at 2026-02-05T19:39:14-08:00 Fix #469: Reenable cr_pow - - - - - 6ac1b6b4 by Raymond Toy at 2026-02-05T19:39:14-08:00 Merge branch 'issue-469-enable-cr-pow' into 'master' Fix #469: Reenable cr_pow Closes #469 and #470 See merge request cmucl/cmucl!346 - - - - - f795ec67 by Raymond Toy at 2026-02-05T20:28:36-08:00 Merge branch 'master' into issue-468-core-math-signals - - - - - 6 changed files: - .gitlab-ci.yml - bin/run-unit-tests.sh - src/lisp/GNUmakefile - src/lisp/irrat.c - tests/issues.lisp - + tests/test-run-prog/ls-link Changes: ===================================== .gitlab-ci.yml ===================================== @@ -147,7 +147,9 @@ linux:build: - job: linux:install artifacts: true variables: - CONFIG: "x86_linux_clang" + # Fedora 41 must build with gcc because the clang build fails some + # ansi-tests. See [#469]. + CONFIG: "x86_linux" # These rules is needed so that the static analyzer job can run on a # schedule because this is a prerequisite of the analyzer build. A # regular push or merge request does the normal stuff. @@ -171,7 +173,7 @@ linux:cross-build: - linux-4/lisp variables: # This must match the config used for the linux build! - CONFIG: "x86_linux_clang" + CONFIG: "x86_linux" needs: @@ -346,7 +348,10 @@ ubuntu:build: - job: ubuntu:install artifacts: true variables: - CONFIG: "x86_linux_clang" + # Build with gcc on Ubuntu 25.10. It produces a lisp than passes + # the ansi-tests. Clang seems to fail the ansi-tests WRITE.1, + # PRINT.1, and friends when cr_pow is used. + CONFIG: "x86_linux" ubuntu:test: <<: *unit_test_configuration ===================================== bin/run-unit-tests.sh ===================================== @@ -42,9 +42,9 @@ done shift $((OPTIND - 1)) # Create the test directory needed by the issue.45 test. -rm -rf test-tmp -mkdir test-tmp -ln -s /bin/ls test-tmp/ls-link +#rm -rf test-tmp +#mkdir test-tmp +#ln -s /bin/ls test-tmp/ls-link # Set the timestamps on 64-bit-timestamp-2038.txt and # 64-bit-timestamp-2106.txt, but only for OSes where we know this @@ -56,8 +56,9 @@ ln -s /bin/ls test-tmp/ls-link # tests/os.lisp. case `uname -s` in Linux) - touch -d "1 April 2038" tests/resources/64-bit-timestamp-2038.txt - touch -d "1 April 2106" tests/resources/64-bit-timestamp-2106.txt + # -t format is [[CC]YY]MMDDhhmm[.ss] + touch -t 203804010000 tests/resources/64-bit-timestamp-2038.txt + touch -t 210604010000 tests/resources/64-bit-timestamp-2106.txt ;; esac ===================================== src/lisp/GNUmakefile ===================================== @@ -55,7 +55,7 @@ version.o : version.c version mv ,version version $(CC) ${CFLAGS} $(CPPFLAGS) -DVERSION=`cat version` -c $< -lisp: ${OBJS} ${CORE64_OBJS} version.o +lisp: ${OBJS} version.o $(CC) -g ${OS_LINK_FLAGS} -o ,lisp $^ ${OS_LIBS} -lm mv -f ,lisp lisp @@ -75,7 +75,7 @@ internals.h internals.inc: @false clean: - $(RM) Depends *.o $(CORE64_OBJS) lisp lisp.nm core lisp.a + $(RM) Depends $(OBJS) lisp lisp.nm core lisp.a echo 'Map file for lisp version 0' > lisp.nm depend: Depends ===================================== src/lisp/irrat.c ===================================== @@ -39,14 +39,21 @@ extern void cr_sincos(double, double *, double *); * Wrappers for the special functions */ +#define MAYBE_SIGNAL_INVALID(test, val) \ + if ((test)) { \ + return fdlibm_setexception(val, FDLIBM_INVALID); \ + } + +#define MAYBE_SIGNAL_OVERFLOW(x) \ + if (isinf(x)) { \ + return fdlibm_setexception(x, FDLIBM_OVERFLOW); \ + } + double lisp_sin(double x) { #ifdef FEATURE_CORE_MATH - /* Signals invalid if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_INVALID); - } + MAYBE_SIGNAL_INVALID(isinf(x), x) return cr_sin(x); #else @@ -58,10 +65,7 @@ double lisp_cos(double x) { #ifdef FEATURE_CORE_MATH - /* Signals invalid if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_INVALID); - } + MAYBE_SIGNAL_INVALID(isinf(x), x) return cr_cos(x); #else @@ -73,10 +77,7 @@ double lisp_tan(double x) { #ifdef FEATURE_CORE_MATH - /* Signals invalid if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_INVALID); - } + MAYBE_SIGNAL_INVALID(isinf(x), x) return cr_tan(x); #else @@ -128,10 +129,7 @@ double lisp_sinh(double x) { #ifdef FEATURE_CORE_MATH - /* Signal overflow if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_OVERFLOW); - } + MAYBE_SIGNAL_OVERFLOW(x) return cr_sinh(x); #else @@ -163,10 +161,7 @@ double lisp_asinh(double x) { #ifdef FEATURE_CORE_MATH - /* Signal overflow if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_OVERFLOW); - } + MAYBE_SIGNAL_OVERFLOW(x) return cr_asinh(x); #else @@ -178,14 +173,9 @@ double lisp_acosh(double x) { #ifdef FEATURE_CORE_MATH - /* Signals invalid if x is not in the domain x >= 1 */ - if (x < 1) { - return fdlibm_setexception(x, FDLIBM_INVALID); - } - /* Signal overflow if x is infinite */ - if (isinf(x)) { - return fdlibm_setexception(x, FDLIBM_OVERFLOW); - } + MAYBE_SIGNAL_INVALID(x < 1, x) + + MAYBE_SIGNAL_OVERFLOW(x) return cr_acosh(x); #else @@ -236,13 +226,17 @@ lisp_log10(double x) double lisp_pow(double x, double y) { +#ifdef FEATURE_CORE_MATH /* - * cr_pow seems causes ansi-tests to fail in test WRITE.1 among - * others. Somewhere an invalid operation is occurring. Thus - * just use fdlibm for now until we can figure out what's causing - * the failure. + * cr_pow when compiled with older versions of gcc or clang can + * cause failures in the ansi-tests [#469]. Ubuntu 25.10 and Fedora 41 + * (gcc only) are known to have compilers that work well enough + * that the ansi-tests pass. */ + return cr_pow(x, y); +#else return __ieee754_pow(x, y); +#endif } double ===================================== tests/issues.lisp ===================================== @@ -436,7 +436,7 @@ (define-test issue.45 (:tag :issues) ;; This depends on run-tests to setup the test directory correctly! - (let* ((test-dir #p"test-tmp/") + (let* ((test-dir #p"tests/test-run-prog/") (test-dir-name (namestring test-dir))) (flet ((do-test (program) (with-output-to-string (s) ===================================== tests/test-run-prog/ls-link ===================================== @@ -0,0 +1,2 @@ +#! /bin/sh +exec /bin/ls "$@" View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/730da685588abfcad4b9329... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/730da685588abfcad4b9329... You're receiving this email because of your account on gitlab.common-lisp.net.
participants (1)
-
Raymond Toy (@rtoy)