Skip to content

tools: widening the parity table found three defects in the table - #3502

Merged
gHashTag merged 1 commit into
masterfrom
c/widen-the-table
Sep 8, 2026
Merged

tools: widening the parity table found three defects in the table#3502
gHashTag merged 1 commit into
masterfrom
c/widen-the-table

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 8, 2026

Copy link
Copy Markdown
Owner

tools: widening the parity table found three defects in the table

Closes #3501

The reader shipped one pass ago found a real family on its first run.
Widening it found THREE DEFECTS IN THE READER, each from a narrower
question than "does the output answer this call?"

  1. THE POPULATION COLUMN COUNTED COMMENTS.

    name as published in code
    sign 63 / 48 1 / 1
    max 51 / 26 4 / 4
    min 19 / 12 4 / 4
    sqrt 100 / 25 33 / 13
    round 136 / 38 63 / 21
    floor 98 / 15 89 / 10
    abs 392 / 45 389 / 43

    A prose line reading "round the mantissa (see round(x))" is not a
    call. The six-name family was published as 796 uses; in code it is
    582. And sign was recommended as a LANGUAGE-LEVEL QUESTION on the
    strength of 63 -- it is one use in one spec.

  2. PASSTHROUGH CONFLATED A GAP WITH A STRATEGY. C emits
    #define assert_eq(a, b) and Zig fn assert_eq(a: anytype, ...);
    both columns read PASSTHROUGH and the report said "no backend lowers
    any of them" about a call TWO BACKENDS ANSWER. The cell distinguishes
    helper now. The probe also gained a test block: C emits that macro
    only when a module has tests, and 528 of 651 specs do, so the probe
    had been measuring an unrepresentative context.

  3. AN #include DECLARES AS SURELY AS A DEFINITION. sqrt is answered
    in C by #include <math.h> and nothing else -- the spelling was
    never wrong -- and the reader looked only for definitions written in
    the file, calling that column a gap for the third time in three
    readings.

AFTER THE CORRECTIONS, abs WAS THE LARGEST REAL C GAP: 389 uses in 43
specs, refused for two passes because C has abs for int and fabs for
double and choosing without the argument's type is a silent truncation.

C11 answers it WITHOUT the type:

#define t27_abs(x) _Generic((x), float: fabsf, double: fabs,
long double: fabsl, default: llabs)(x)

_Generic dispatches on the argument's own type, evaluates it once --
unlike ((x) < 0 ? -(x) : (x)), which names it twice -- and is standard
in the -std=c11 this corpus compiles with. The macro is named
t27_abs and the CALL is rewritten, so a <stdlib.h> abs in scope is
never shadowed; a module declaring its own fn abs keeps it.

errors 10 811 -> 10 802 (-9)
files better/worse 9 / 0
compiling clean 308 -> 309

A TEST CHANGED ON PURPOSE AND SAYS SO. abs_min_and_max_stay_loud
asserted that abs pulls nothing in -- the previous pass's deliberate
limitation, now false by design. It is narrowed to min/max, which no
backend answers, and the comment records why rather than dropping the
assertion quietly.

Tests: 5 new, full suite 3568 passed 0 failed. Five mutants, all killed,
including the one that replaces _Generic with a double-evaluating
ternary. 31 stale seals refreshed.

🤖 Generated with Claude Code

Closes #3501

The reader shipped one pass ago found a real family on its first run.
Widening it found THREE DEFECTS IN THE READER, each from a narrower
question than "does the output answer this call?"

1. THE POPULATION COLUMN COUNTED COMMENTS.

     name    as published   in code
     sign    63 / 48        1 / 1
     max     51 / 26        4 / 4
     min     19 / 12        4 / 4
     sqrt   100 / 25       33 / 13
     round  136 / 38       63 / 21
     floor   98 / 15       89 / 10
     abs    392 / 45      389 / 43

   A prose line reading "round the mantissa (see round(x))" is not a
   call. The six-name family was published as 796 uses; in code it is
   582. And `sign` was recommended as a LANGUAGE-LEVEL QUESTION on the
   strength of 63 -- it is one use in one spec.

2. `PASSTHROUGH` CONFLATED A GAP WITH A STRATEGY. C emits
   `#define assert_eq(a, b)` and Zig `fn assert_eq(a: anytype, ...)`;
   both columns read PASSTHROUGH and the report said "no backend lowers
   any of them" about a call TWO BACKENDS ANSWER. The cell distinguishes
   `helper` now. The probe also gained a test block: C emits that macro
   only when a module has tests, and 528 of 651 specs do, so the probe
   had been measuring an unrepresentative context.

3. AN `#include` DECLARES AS SURELY AS A DEFINITION. `sqrt` is answered
   in C by `#include <math.h>` and nothing else -- the spelling was
   never wrong -- and the reader looked only for definitions written in
   the file, calling that column a gap for the third time in three
   readings.

AFTER THE CORRECTIONS, `abs` WAS THE LARGEST REAL C GAP: 389 uses in 43
specs, refused for two passes because C has `abs` for int and `fabs` for
double and choosing without the argument's type is a silent truncation.

C11 answers it WITHOUT the type:

  #define t27_abs(x) _Generic((x), float: fabsf, double: fabs, \
long double: fabsl, default: llabs)(x)

`_Generic` dispatches on the argument's own type, evaluates it once --
unlike `((x) < 0 ? -(x) : (x))`, which names it twice -- and is standard
in the `-std=c11` this corpus compiles with. The macro is named
`t27_abs` and the CALL is rewritten, so a `<stdlib.h>` `abs` in scope is
never shadowed; a module declaring its own `fn abs` keeps it.

  errors            10 811 -> 10 802   (-9)
  files better/worse     9 / 0
  compiling clean      308 -> 309

A TEST CHANGED ON PURPOSE AND SAYS SO. `abs_min_and_max_stay_loud`
asserted that `abs` pulls nothing in -- the previous pass's deliberate
limitation, now false by design. It is narrowed to `min`/`max`, which no
backend answers, and the comment records why rather than dropping the
assertion quietly.

Tests: 5 new, full suite 3568 passed 0 failed. Five mutants, all killed,
including the one that replaces `_Generic` with a double-evaluating
ternary. 31 stale seals refreshed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) September 8, 2026 14:13
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-08 14:13:54 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 13
PRs with All Checks Green 3
READY 2
FAILING 13
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 13 + 0 + 0 = 15, and there are 16 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=d4c5b22b471e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit f6a4a0f into master Sep 8, 2026
30 of 33 checks 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.

tools: widening the parity table found three defects in the table -- and abs answered without the type

1 participant