Unverified Commit bdd4fb50 authored by Philip Taron's avatar Philip Taron
Browse files

sbclPackages.cl-ana: fix type error in fixed-mem-cache for SBCL 2.6.0

In cl-ana.makeres, the fixed-mem-cache function uses
(setf (cdr (last cache)) (list id)) where cache can be nil (initial
state or after popping all elements). (last nil) returns nil, making
(setf (cdr nil) ...) undefined. SBCL 2.6.0's stricter type inference
catches this as a type conflict, causing COMPILE-FILE-ERROR.

Replace with nconc which handles the nil case correctly.
parent ddcc48c3
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
Fix type error in fixed-mem-cache for SBCL 2.6.0

cache starts as nil and may be emptied by the loop, so (last cache)
can return nil. (setf (cdr nil) ...) is undefined behavior that
SBCL 2.6.0 now catches as a type conflict during compilation,
causing COMPILE-FILE-ERROR.

Use nconc instead, which handles the nil case correctly.

Upstream issue: https://github.com/ghollisjr/cl-ana/issues/48

--- a/makeres/makeres.lisp
+++ b/makeres/makeres.lisp
@@ -936,5 +936,5 @@
                    do (unload-target (pop cache))))
               (load-target id)
-              (setf (cdr (last cache))
-                    (list id)))))))))
+              (setf cache
+                    (nconc cache (list id))))))))))
+3 −0
Original line number Diff line number Diff line
@@ -191,6 +191,9 @@ let
          "iolib/pathnames"
        ];
      });
      cl-ana_dot_makeres = super.cl-ana_dot_makeres.overrideLispAttrs (o: {
        patches = (o.patches or [ ]) ++ [ ./patches/cl-ana-fix-type-error.patch ];
      });
      cl-ana_dot_hdf-cffi = super.cl-ana_dot_hdf-cffi.overrideLispAttrs (o: {
        nativeBuildInputs = [ pkgs.hdf5 ];
        nativeLibs = [ pkgs.hdf5 ];