Skip to content

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

Merged
staalmannen merged 2 commits into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Oct 7, 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 7, 2026 07:43
gmake would not link: "_convM2D: multiple initialization" on DATA
records for switches<17>, GNU make's static array of struct
command_switch.

In sualign()'s TSTRUCT loop, o carries the offset of the current
bit-field unit across iterations: the first field of a group sets it
and every later field reads it back.  The max-member-alignment loop
added for -J wrote its own result into o as well, so the second and
later fields of each group were placed at the previous member's
alignment instead of the unit's offset.  Here that put toenv,
no_makefile and specified at offset 4, on top of the enum member, and
6l refused every array entry whose two writes to those four bytes were
both non-zero.

The line is not gated on conformalign, so plain builds were affected
too; this has been wrong since 81a59a1.  A separate variable now, in
both the TSTRUCT and TUNION arms.

structalign-test gains section 8 with that shape.  Section 4's struct
bits could not have caught it: its bit fields are the first members,
so the clobbered value was the alignment of nothing.  offsetof cannot
name a bit field, so the section asserts the collision instead -- set
each field of the group and ask whether the earlier member survived.
0 failures on gcc.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
The code for this landed in 6c51444 by a careless "git add -A"; that
commit's message describes only the sualign fix.  Recording it here
rather than rewriting pushed history.

<signal.h> declared signal() and sa_handler with empty parameter lists
so that libap's three-argument Plan 9 dispatch -- handler(int, char
*msg, Ureg *u) -- stayed reachable.  That turned off argument checking
for every caller in the tree, and the header did not match libap
either: signal/signal.c defined signal() with the three-argument type.

Both are void (*)(int) now, with SIG_DFL, SIG_ERR and SIG_IGN moving
with them.  _sighdlr[] holds the POSIX type and the cast to the
extended form sits at the one place that calls a handler, _notetramp,
so _envsetup.c and sigwait.c need none.  The eleven arch notetramp.c
are untouched.  sigaction.c loses four casts that existed only because
nothing had a type to agree with.

Nothing in the tree uses the extension: of 56 handler names reaching
signal(), two take more than one argument and neither is this form.

Baseline measured on the host: signal.c, sigaction.c, sigwait.c and
_envsetup.c give 1 error before and 1 after, the same pre-existing one
-- lib.h declares _notehandler(void *) to match _NOTIFY while signal.c
defines it (Ureg *).  Recorded, not fixed: narrowing the declaration
moves the mismatch to the _NOTIFY call.

apehdr-sweep: 149 headers, 0 findings; together-case unchanged at 12.

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