Skip to content

t27b: integer constants wider than 64 bits (type u128, u256, u512, u1024), folded at compile time #7423

Closed

Description

@gHashTag

t27b refuses every spec that names an integer type wider than 64 bits. The corpus has five: specs/numeric/gft128.t27 (type u128), gft256.t27 (type u256), gft512.t27 (type u512), gft1024.t27 (type u1024), and specs/port/bootstrap/src/phi_f64_literals.t27 (type i128).

In the four gft specs, the wide values are module constants with literal values. t27c's Zig backend prints const X: u128 = <literal>; unchanged, so Zig's compiler folds every operation on X at compile time, at any width. Only a comparison (a bool) or an as (@intCast to a 64-bit type) ever reaches run time.

This slice adds that to t27b:

  • Exact big-integer folding of wide module constants, following Zig's comptime rules: + - * must stay inside the type, << drops the bits shifted out, >> rounds toward minus infinity, / % need a non-zero divisor and non-negative operands, and two typed operands must share one type.
  • A comparison of wide values becomes a constant bool.
  • An as back to a standard width must fit, because @intCast at compile time is checked.
  • A fn that no test reaches may name a wide type in its signature: Zig never resolves it. This works the same way as unresolved_sig does today for a struct whose layout fails.

These stay refused, by name, as type u128 and the like:

  • a run-time wide value (a parameter of a reached fn, a local, a result, a wide constant mixed with a run-time operand);
  • anything Zig's compiler would reject.

phi_f64_literals.t27 stays blocked. It uses i128 as a run-time value (a parameter and a local), which needs register pairs through t27b's one-register IR. It also needs tuples, str == and string indexing, which other lanes own. That is a separate slice, not this one.

Conformance spec first: specs/tri/t27b/conformance/wide_int_const.t27. t27c test-report gives 4/4 pass with 0 vacuous on the Railway lab.

Refs #6063 (lane 3). Earlier parked item: #7245.

Boundary

  • specs/numeric/gft128.t27
  • specs/port/bootstrap/src/phi_f64_literals.t27
  • specs/tri/t27b/conformance/wide_int_const.t27

Activity

  1. gHashTag commented on Oct 7, 2026

    @gHashTag
    OwnerAuthor

    Parked. PR #7440 implements this slice and its corpus run is clean: 6 files move from blocked to pass, mismatch 0. It adds 854 hand-written Rust lines, so the foreign-line budget from #7371 (40 per file, 80 per PR, no label lifts it) denies it. The folding logic has to be written in .t27 and generated by t27c (t27b port #6198) before this can land. Details: #7440 (comment)

  2. added
    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it
    and removed
    needs-boundaryNo '## Boundary' section, so the Queen can reserve nothing for it and no bee can take it
    on Oct 7, 2026
  3. gHashTag commented on Oct 7, 2026

    @gHashTag
    OwnerAuthor

    Reopened 2026-10-07: the bulk close of issues without a ## Boundary section was reverted by the owner. Nothing to do here; this comment replaces the earlier close notice.

  4. added
    needs-shapeIssue lacks Boundary/Scenarios/Requirements/Success criteria
    on Oct 7, 2026
  5. removed
    needs-shapeIssue lacks Boundary/Scenarios/Requirements/Success criteria
    on Oct 7, 2026
  6. added 3 commits that reference this issue on Oct 8, 2026
    610223e
    4834cb1
    3020125
  7. added a commit that references this issue on Oct 8, 2026
    5f30871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions