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 str passed in a variadic C position is read as two words #2574
Spec §16.3c / §16 (a const char * parameter accepts a str, passed as NUL-terminated input text). A variadic position has no parameter type, and the compiler passes the fat str value as is; C reads its pointer, then its length word as the next argument.
use std.libc
fprintf(libc_stderr(), c"%s|%d\n".ptr, "compress", 7)
fprintf(libc_stderr(), c"%s|%d\n".ptr, c"compress".ptr, 8)
Expected compress|7 then compress|8; actual compress|8 twice (the first %d read the str's length, 8).
Expected: a str in a variadic C position is lent as its NUL-terminated pointer, as a const char * parameter lends it, or the call is refused with a diagnostic naming the position. Workaround: c"...".ptr (the migrator renders a literal there so since #2556; the basic-tests fixture macro_body_string_literal now expects it).
Fixed in #2580 (c7fa606): a str (or &str) in a variadic slot is given the promoted type *const c_char (record_c_promoted_args), and codegen's existing C-string lending passes the NUL-terminated pointer. An unprototyped call keeps #1831's refusal. Fixture behav_2574.
Activity
The migrator rules M*LIB's upstream B+tree test exposed; the gate run…
Seven compiler fixes: literals at distinct demands (D153), element-pl…
ehartford commentedon Oct 23, 2026
Fixed in #2580 (c7fa606): a str (or &str) in a variadic slot is given the promoted type *const c_char (record_c_promoted_args), and codegen's existing C-string lending passes the NUL-terminated pointer. An unprototyped call keeps #1831's refusal. Fixture behav_2574.