Skip to content

Claude/upgrade ape c library mm z gd - #611

Merged
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Oct 8, 2026
Merged

staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits October 8, 2026 03:22
`mk -k install' on the VM: only `c99_complex.c' fails, predicted by
name and by token (`syntax error, last name: _Float16').  It is the
C99 `_Complex' runtime, built on gcc's extended floats, which bring
libgcc's soft-float family with them; commented out of OFILES now the
measurement is taken, since a C++ front end has no use for it.

THE TWO `__thread' PREDICTIONS WERE WRONG AND THAT IS THE USEFUL HALF.
`thread_dtor.c' and `dtor_list.c' compile: `cc/lex.c:1765' has carried
`"__thread", LNAME, 0' and a swallow at `:1095' all along, under the
comment "Plan 9 has no TLS; silently drop the qualifier."  I checked
EDG's constructs against C dialects from memory instead of against the
compiler in this repository.  An instrument whose keyword list is not
the COMPILER's keyword list is measuring a different compiler -- the
include-path lesson apdecl-sweep and apehdr-sweep each paid for,
arriving one level down for a lexer.  Asking `itab' plus the swallow
list about the four float types afterwards is what says c99_complex.c
really is the only failure.

And that pass is not a clean bill: `__thread' dropped makes
`__thread_needed_destruction_head' one process-wide global shared by
every thread rather than one per thread, which is the
stub-answering-the-wrong-thing shape.  Harmless for cpfe, which is
single-threaded; a live hazard for anything cpfe translates.
Recorded, not fixed.

The entry is removed from OFILES outright rather than commented out:
a `#' line inside a continued list ends the assignment unless it ends
in a backslash, which is the mkcont-sweep rule, and my first attempt
put the backslash before the comment.  mkcont-sweep: 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
`mk -k install' in sys/src/ape/cmd/edg floods with

  cpp: src/class_decl.c:32786 #line specifies number out of range

EDG's generated C carries a #line for nearly every statement, pointing
back at the C++ it was translated from, and 113,411 of them are over
32768 -- 100,656 in src/sys_predef.c alone.  It is a WARNING and
nothing fails because of it, but the output is unreadable, which
matters for the reason this tree already records: a harmless message
that lands in a captured stream stops being harmless to the
measurement.  It would hide the compile result it is printed beside.

NOTHING DOWNSTREAM IS 16-BIT, checked end to end rather than reasoned.
`Source.line' in cpp.h is an int; `cc''s lineno is a long (cc.h:459);
and every backend writes FOUR bytes -- 6c/swt.c:259-262 and 8c spell
it `Bputc(b, p->lineno>>24)', while 5c, 7c, 9c, kc, qc, vc, 1c and 2c
use the byte-array form `bf[6] = l>>24'.  A grep for the first idiom
alone reports six backends as unchecked and is wrong about all six:
the name differs, the width does not.  6l/obj.c:871 reads the same
four bytes back.  So 32768 is inherited from an older object format
and bounds nothing that exists.

Raised to INT_MAX.  The `<0' arm is kept and is the half that still
does work: this file is built by native 6c, where long and int are
both 32 bits, so a #line beyond that range comes back from atol
saturated or wrapped, and a wrapped one is negative.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen
staalmannen merged commit 1311a03 into main Oct 8, 2026
1 check passed
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.

2 participants