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
A narrower integer auto-referenced at a user &i64 parameter is read in place: -1 arrives as 4294967295 #2336
Spec: §4.2.6 (an integer widens into a wider type "on every container argument, as it does at a let or a call"), §3.8 (auto-referencing).
Repro (installed compiler on main, and D114 stage1):
fn f(x: &i64) -> i64: *x
fn main:
let a: i32 = -1
let b: i32 = -2
print(f(a))
print(f(b))
Expected: -1 and -2. The argument widens to i64, which must be materialized as an i64 temporary for the &i64 to view.
Actual:
4294967295
4294967294
The call passes the address of the four-byte i32 place and the callee reads eight bytes.
The std containers already do this correctly: test/behavior/behav_container_arg_widening.w (v64.contains(u) with u: u32, k.get(u) over HashMap[i64, i64]) widens through the container intrinsics in codegen. A user function's &T parameter takes the plain auto-reference path instead.
Fix direction: Sema records the widening conversion on an auto-referenced argument (as it records a contextual copy), and MIR materializes a temporary of the pointee type and passes its address. Refusing the call instead would contradict §4.2.6 and the container test.
Found during the D114 corpus run (#2327). D114 makes the case common because a literal list is a List[isize].
Fixed on branch d115-d120 (commit b8ce24c): can_auto_ref_arg_frozen accepts the widening types_compatible accepts for a numeric pointee, so the argument takes the auto-reference path, and lower_auto_ref_call_arg materializes a temporary of the pointee's type and views that. Before, the call went by value (call f(copy _1) with _1: i32 against &i64). Fixture: test/behavior/behav_2336_autoref_widening.w.
Activity
D114: a demanded range types its bounds; literal membership operands;…
D114: isize is the target's size width — literal default, len family,…
ehartford commentedon Oct 11, 2026
Fixed on branch d115-d120 (commit b8ce24c):
can_auto_ref_arg_frozenaccepts the widening types_compatible accepts for a numeric pointee, so the argument takes the auto-reference path, andlower_auto_ref_call_argmaterializes a temporary of the pointee's type and views that. Before, the call went by value (call f(copy _1)with_1: i32against&i64). Fixture: test/behavior/behav_2336_autoref_widening.w.D114/D128 gaps (#2333, #2336, #2343), D111 clones (#2271), D115 Amend…
ehartford commentedon Oct 11, 2026
Merged to main in e4861e1 (#2349), battery green.