You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
t27c: const inlining drops the declared u64 type, shift lowers as u32 #13369
Observed 2026-11-08 on branch lane/t27l-core (commit 2457ab7), for specs/t27os/t27t.t27 fn tt_range_mask before that commit. Refs #6092 (open epic: t27c silent misreads to zero). The self-host epic #5980 is closed.
Const inlining loses the declared type. const one : u64 = 1; m = m | (one << k); lowered to (@as(u32, 1) << @intCast(k)) in generated Zig: the width was re-invented from the literal magnitude (1 fits u32) instead of taken from the const's declared u64. So k >= 32 panics in a debug test run, and would wrap or truncate in release. Silent misread. Workaround in the spec: (@as(u64, 1) << @as(u6, @intCast(k))). Related: the declared-type path for let initializers already exists (zig_declared_int_type); the const-inlined use site does not consult it.
Repro (not run: gen is not run on the bench Mac; the observed instance is named above):
module m
const one : u64 = 1;
pub fn mask(k: u32) -> u64 {
var m : u64 = 0;
m = m | (one << k);
return m;
}
test mask_high { assert mask(40) == 1099511627776; }
endmodule
Given a module const declared u64, when it is used as the left side of a runtime shift, then the generated Zig pins the left side to u64.
Given a const with no declared integer type, when it is shifted, then the magnitude default is unchanged.
Requirements
FR-001: a const-inlined use MUST carry the const's declared integer type into the shift lowering.
FR-002: the shift amount MUST be cast to the log2 width of the left side type so k >= 32 does not trap.
Success Criteria
The repro test mask_high passes in a debug test run with 0 panics.
The generated Zig contains 0 occurrences of @as(u32, 1) << for that fn.
t27c test-report specs/t27os/t27t.t27 reports FAIL 0 and vacuous passes 0 with the spec's explicit @as(u64, 1) workaround reverted to const one : u64 = 1;, and t27b test specs/t27os/t27t.t27 --check --quiet ends in exit 0.
Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.
missing: ## Success Criteria -- an outcome a machine can settle: a number with a unit, a backticked file, exit 0, or a backticked command
Reopened: closed as spec-only. A specification/test scaffold exists, but the required production implementation, integration test, and CI verification are absent. This issue remains open until the target component implements the specified behavior and evidence is provided.
Reopened: closed as spec-only. A .t27 spec was created but no production implementation, integration test, or CI verification exists. This issue remains open until the target component implements the specified behavior and evidence is provided.
Activity
github-actions commentedon Nov 8, 2026
Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.
exit 0, or a backticked commandgithub-actions commentedon Nov 8, 2026
The shape check passes now (specs/policy/issue_shape.t27); reopened.
gHashTag commentedon Nov 17, 2026
Covered by specs/tri/compiler_issues.t27 (typecheck OK, 1 test pass).
gHashTag commentedon Nov 17, 2026
Reopened: closed as spec-only. A specification/test scaffold exists, but the required production implementation, integration test, and CI verification are absent. This issue remains open until the target component implements the specified behavior and evidence is provided.
gHashTag commentedon Nov 17, 2026
Spec exists and passes typecheck + tests. M2 milestone complete.
gHashTag commentedon Nov 18, 2026
Reopened: closed as spec-only. A .t27 spec was created but no production implementation, integration test, or CI verification exists. This issue remains open until the target component implements the specified behavior and evidence is provided.