Skip to content

cmpltv: don't raise from print-object on a half-built creator - #1827

Open
dg1sbg wants to merge 1 commit into
clasp-developers:mainfrom
dg1sbg:fix/cmpltv-print-object-guard
Open

cmpltv: don't raise from print-object on a half-built creator#1827
dg1sbg wants to merge 1 commit into
clasp-developers:mainfrom
dg1sbg:fix/cmpltv-print-object-guard

Conversation

@dg1sbg

@dg1sbg dg1sbg commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Two small robustness changes in src/lisp/kernel/cmp/cmpltv.lisp. Neither fixes a bug I can currently demonstrate; both were found while chasing a failure whose real cause the first one was actively hiding.

print-object can raise and swallow the condition it was printing

print-object for vcreator already guards %prototype with slot-boundp, but reads (index object) unguarded three lines later — and the creator method reads it unguarded too. A creator whose index has not yet been assigned therefore signals an unbound-slot error from inside the printer, which replaces whatever condition was actually being reported and splices the new message into the middle of the old one:

#<CMPLTV::BASE-STRING-CREATOR [no prototype]The slot CMPLTV::%INDEX is
                                            unbound in an instance of
                                            CMPLTV::BASE-STRING-CREATOR.

That is what the failure I was investigating looked like, and it cost real time — the visible error is entirely about the printer, while the original condition is gone. This guards both reads the way %prototype already is, so such an object prints as [no index] and the real condition survives.

%index type contradicts its own initform

The slot is declared :type (integer 0) with :initform nil, which the type excludes. Upstream Maclina has :type (or null (integer 0)) for the same slot; this looks like drift. Nothing enforces it today — I checked, make-instance stores nil there without complaint — so this is tidiness rather than a fix, but the declaration should not contradict the initform.

Verification

x86-64 Linux, LLVM 18, --build-mode=bytecode: builds clean, regression suite 1963 successes / TEST_EXIT=0, identical to baseline.

@dg1sbg

dg1sbg commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Note on the two CI reds — both are the same known flake, and neither relates to this change.

clasp/ubuntu-latest/native and cando/ubuntu-latest/native each failed with WEAK-KEY-AND-VALUE-WEAKNESS as the sole failure, Successes: 1962, and the normal 2 aborted compilation units. That is #1814, where I have posted frequency data — it accounted for seven Linux job failures across five unrelated PRs today.

This PR touches only print-object methods and one slot type declaration in cmpltv.lisp; it has no plausible connection to weak hash tables or the GC.

clasp/ubuntu-latest/bytecode passed, and I separately verified this change on x86-64 Linux: clean build, regression suite 1963 successes / TEST_EXIT=0, identical to baseline.

print-object for vcreator guards %prototype with slot-boundp but reads
(index object) unguarded, and the creator method reads it unguarded
too.  A creator whose index has not been assigned therefore signals an
unbound-slot error from inside the printer, which replaces whatever
condition was actually being reported and splices the new message into
the middle of the old one:

  #<CMPLTV::BASE-STRING-CREATOR [no prototype]The slot CMPLTV::%INDEX
    is unbound in an instance of CMPLTV::BASE-STRING-CREATOR.

Guard both reads the way %prototype already is.

Also widen the %index slot type to (or null (integer 0)), matching
Maclina.  The slot's initform is nil, which the declared (integer 0)
excludes; nothing enforces it today, but the declaration contradicts
the initform.
@dg1sbg
dg1sbg force-pushed the fix/cmpltv-print-object-guard branch from c260817 to f7c25c5 Compare August 13, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant