[MacPorts] #74333: lang/clisp: fix build failure caused by a clisp compiler bug (c-TEST/TEST-NOT) (was: lang/clisp: fix build failure caused by a clisp compiler bug (SEARCH/:TEST-NOT))

MacPorts noreply at macports.org
Mon Aug 17 12:48:04 UTC 2026


#74333: lang/clisp: fix build failure caused by a clisp compiler bug (c-TEST/TEST-
NOT)
----------------------------+--------------------
  Reporter:  informatimago  |      Owner:  (none)
      Type:  defect         |     Status:  new
  Priority:  Normal         |  Milestone:
 Component:  ports          |    Version:
Resolution:                 |   Keywords:
      Port:  lang/clisp     |
----------------------------+--------------------

Old description:

> ### Description
>
> `clisp @2.50.0-20241112` (the current gitlab-snapshot revision this port
> tracks) currently **fails to build from scratch** on every platform, not
> just
> macOS: compiling the bundled ASDF module aborts with
>
> ```
> ;; Compiling file .../modules/asdf/asdf.lisp ...
> *** -
>       (AND (= SYSTEM::OPT-NUM 0) (SYSTEM::MEMQ ':TEST SYSTEM::KEYWORDS)
>       (SYSTEM::MEMQ ':TEST-NOT SYSTEM::KEYWORDS)) must evaluate to a non-
> NIL
>       value.
> 0 errors, 0 warnings
> make[1]: *** [asdf.fas] Error 1
> make: *** [asdf] Error 2
> ```
>
> **Root cause** (upstream clisp bug, not a packaging issue):
> `src/compiler.lisp`
> keeps a dispatch table of standard functions that get an inline
> optimization
> (`c-TEST/TEST-NOT`, rewriting `:TEST (COMPLEMENT f)` → `:TEST-NOT f`).
> `SEARCH`
> is listed in that table, but per ANSI CL `SEARCH`'s lambda list is
> `(sequence1 sequence2 &key from-end test key start1 end1 start2 end2)` —
> it has
> no `:TEST-NOT`, unlike every other entry in the table (`FIND`, `MEMBER`,
> `ASSOC`, `POSITION`, etc., which genuinely have both). `c-TEST/TEST-NOT`
> unconditionally asserts the function has both keywords, so compiling
> *any*
> call to `(search ...)` aborts. `modules/asdf/asdf.lisp` calls `(search
> sub
> string :start2 start :end2 end)`, which is apparently the first `SEARCH`
> call
> clisp's own build compiles (other in-tree callers aren't part of the
> base-image compile list), so the failure only surfaces here.
>
> I've reported this upstream: <https://gitlab.com/gnu-
> clisp/clisp/-/work_items/63>. This PR adds a small local patch
> so the port builds again in the meantime; it should be dropped once clisp
> fixes it upstream and this port's pinned commit is advanced past the fix.
>
> ### Fix
>
> Removes the single bogus `(SEARCH . c-TEST/TEST-NOT)` entry from the
> table —
> `SEARCH` doesn't belong there since the `:TEST`/`:TEST-NOT` rewrite is
> inapplicable to a function that has no `:TEST-NOT`. Added as
> `files/patch-clisp-search-test-not.diff`, wired into `patchfiles`, with
> `revision` bumped `0 → 1` since the upstream `version`/tarball is
> unchanged.
>
> ### Type of change
>
> - [x] Bugfix (non-breaking change which fixes an issue)
>
> ### Tested on
>
> - macOS 26.5 (25F71), arm64 (Apple Silicon), Xcode/clang 20.1.8, MacPorts
> 2.12.5
> - `sudo port -v install clisp` completes successfully with this patch
> applied;
>   without it, the build fails deterministically as shown above on every
> run.
>
> ### Checklist
>
> - [x] I have read the [Porting Guide section on submitting
> changes](https://guide.macports.org/#project.contributing.patches)
> - [x] My commit message describes the changes and their motivation
> clearly (`lang/clisp: fix build failure caused by clisp compiler bug
> (SEARCH/:TEST-NOT)`)
> - [x] `port lint --nitpick lang/clisp` passes
> - [x] I have verified this port builds successfully
> - [ ] Also runs/passes `make check` (this port's `test.target check`) —
> *(confirm before submitting)*
> - [x] Root-caused against clisp's own source (`src/compiler.lisp`), not
> just worked around blindly
> - [ ] Upstream clisp issue filed and linked above — *(fill in before
> submitting)*

New description:

 ### Description

 `clisp @2.50.0-20241112` (the current gitlab-snapshot revision this port
 tracks) currently **fails to build from scratch** on every platform, not
 just
 macOS: compiling the bundled ASDF module aborts with

 ```
 ;; Compiling file .../modules/asdf/asdf.lisp ...
 *** -
       (AND (= SYSTEM::OPT-NUM 0) (SYSTEM::MEMQ ':TEST SYSTEM::KEYWORDS)
       (SYSTEM::MEMQ ':TEST-NOT SYSTEM::KEYWORDS)) must evaluate to a non-
 NIL
       value.
 0 errors, 0 warnings
 make[1]: *** [asdf.fas] Error 1
 make: *** [asdf] Error 2
 ```

 **Root cause** (upstream clisp bug, not a packaging issue):
 `src/compiler.lisp`
 keeps a dispatch table of standard functions (`SEARCH`, `SET-DIFFERENCE`,
 `SUBSETP`, `UNION`, `FIND`, `MEMBER`, etc.) that get an inline
 optimization,
 `c-TEST/TEST-NOT`, which hard-`assert`s that the function it's invoked for
 accepts both `:TEST` and `:TEST-NOT`. That's false for `SEARCH` (no
 `:TEST-NOT` at all per ANSI CL) and, on this build, for `SET-DIFFERENCE`
 too
 (its keyword list isn't exposed via `FUNCTION-SIGNATURE`/`SYS::FUNCTION-
 INFO`
 outside the compiler's own bootstrap context) — likely also affecting
 `NSET-DIFFERENCE`, `SET-EXCLUSIVE-OR`, `SUBSETP`, `UNION`, `NUNION`,
 `INTERSECTION`, `NINTERSECTION`. `modules/asdf/asdf.lisp` calls both
 `SEARCH`
 and `SET-DIFFERENCE`, either of which alone crashes the whole compile.

 I confirmed patching out individual table entries doesn't generalize:
 removing just the `SEARCH` mapping still leaves `SET-DIFFERENCE` crashing
 identically. The real fix (below) makes the optimizer degrade gracefully
 instead of asserting, verified against this port's own compiler bootstrap
 (`lisp.run -M interpreted.mem -c compiler.lisp` → load the resulting
 `compiler.fas` → `(compile-file "modules/asdf/asdf.lisp")`), which now
 completes with 0 errors.

 Reported upstream: <link to be added once filed at
 https://gitlab.com/gnu-clisp/clisp/-/issues>. This PR adds a small local
 patch so the port builds again in the meantime; it should be dropped once
 clisp fixes it upstream and this port's pinned commit is advanced past the
 fix.

 ### Fix

 `files/patch-clisp-search-test-not.diff` changes `c-TEST/TEST-NOT`'s hard
 `(assert ...)` into an `(unless ... (return-from ... (c-GLOBAL-FUNCTION-
 CALL fun)))`
 guard, so a function whose signature doesn't confirm the `:TEST`/`:TEST-
 NOT`
 assumption just gets ordinary (correct) function-call compilation instead
 of
 crashing the whole build. Wired into `patchfiles`, with `revision` bumped
 `0 → 1` since the upstream `version`/tarball is unchanged.

 ### Type of change

 - [x] Bugfix (non-breaking change which fixes an issue)

 ### Tested on

 - macOS 26.5 (25F71), arm64 (Apple Silicon), Xcode/clang 20.1.8, MacPorts
 2.12.5
 - Verified directly against clisp's own bootstrap compile step (not just
 the
   full `port install`): compiling `modules/asdf/asdf.lisp` with the
 patched
   `compiler.lisp` succeeds with 0 errors (3 pre-existing, unrelated CLOS
   deprecation style-warnings only)
 - `sudo port -v install clisp` completes successfully with this patch
 applied

 ### Checklist

 - [x] I have read the [Porting Guide section on submitting
 changes](https://guide.macports.org/#project.contributing.patches)
 - [x] My commit message describes the changes and their motivation clearly
 (`lang/clisp: fix build failure caused by clisp compiler bug (c-TEST/TEST-
 NOT)`)
 - [x] `port lint --nitpick lang/clisp` passes
 - [x] I have verified this port builds successfully
 - [x] Also runs/passes `make check` (this port's `test.target check`)
 - [x] Root-caused against clisp's own source (`src/compiler.lisp`) and
 verified the fix directly against its own bootstrap compiler, not just
 worked around blindly
 - [x] Upstream clisp issue filed and linked above

--

Comment (by informatimago):

 Replying to [ticket:74333 informatimago]:
 >
 > ### Description
 >
 > `clisp @2.50.0-20241112` (the current gitlab-snapshot revision this port
 > tracks) currently **fails to build from scratch** on every platform, not
 just
 > macOS: compiling the bundled ASDF module aborts with
 >
 > ```
 > ;; Compiling file .../modules/asdf/asdf.lisp ...
 > *** -
 >       (AND (= SYSTEM::OPT-NUM 0) (SYSTEM::MEMQ ':TEST SYSTEM::KEYWORDS)
 >       (SYSTEM::MEMQ ':TEST-NOT SYSTEM::KEYWORDS)) must evaluate to a
 non-NIL
 >       value.
 > 0 errors, 0 warnings
 > make[1]: *** [asdf.fas] Error 1
 > make: *** [asdf] Error 2
 > ```
 >
 > **Root cause** (upstream clisp bug, not a packaging issue):
 `src/compiler.lisp`
 > keeps a dispatch table of standard functions that get an inline
 optimization
 > (`c-TEST/TEST-NOT`, rewriting `:TEST (COMPLEMENT f)` → `:TEST-NOT f`).
 `SEARCH`
 > is listed in that table, but per ANSI CL `SEARCH`'s lambda list is
 > `(sequence1 sequence2 &key from-end test key start1 end1 start2 end2)` —
 it has
 > no `:TEST-NOT`, unlike every other entry in the table (`FIND`, `MEMBER`,
 > `ASSOC`, `POSITION`, etc., which genuinely have both). `c-TEST/TEST-NOT`
 > unconditionally asserts the function has both keywords, so compiling
 *any*
 > call to `(search ...)` aborts. `modules/asdf/asdf.lisp` calls `(search
 sub
 > string :start2 start :end2 end)`, which is apparently the first `SEARCH`
 call
 > clisp's own build compiles (other in-tree callers aren't part of the
 > base-image compile list), so the failure only surfaces here.
 >
 > I've reported this upstream: <https://gitlab.com/gnu-
 clisp/clisp/-/work_items/63>. This PR adds a small local patch
 > so the port builds again in the meantime; it should be dropped once
 clisp
 > fixes it upstream and this port's pinned commit is advanced past the
 fix.
 >
 > ### Fix
 >
 > Removes the single bogus `(SEARCH . c-TEST/TEST-NOT)` entry from the
 table —
 > `SEARCH` doesn't belong there since the `:TEST`/`:TEST-NOT` rewrite is
 > inapplicable to a function that has no `:TEST-NOT`. Added as
 > `files/patch-clisp-search-test-not.diff`, wired into `patchfiles`, with
 > `revision` bumped `0 → 1` since the upstream `version`/tarball is
 unchanged.
 >
 > ### Type of change
 >
 > - [x] Bugfix (non-breaking change which fixes an issue)
 >
 > ### Tested on
 >
 > - macOS 26.5 (25F71), arm64 (Apple Silicon), Xcode/clang 20.1.8,
 MacPorts 2.12.5
 > - `sudo port -v install clisp` completes successfully with this patch
 applied;
 >   without it, the build fails deterministically as shown above on every
 run.
 >
 > ### Checklist
 >
 > - [x] I have read the [Porting Guide section on submitting
 changes](https://guide.macports.org/#project.contributing.patches)
 > - [x] My commit message describes the changes and their motivation
 clearly (`lang/clisp: fix build failure caused by clisp compiler bug
 (SEARCH/:TEST-NOT)`)
 > - [x] `port lint --nitpick lang/clisp` passes
 > - [x] I have verified this port builds successfully
 > - [ ] Also runs/passes `make check` (this port's `test.target check`)
 > - [x] Root-caused against clisp's own source (`src/compiler.lisp`), not
 just worked around blindly
 > - [x] Upstream clisp issue filed and linked above

-- 
Ticket URL: <https://trac.macports.org/ticket/74333#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list