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
runtime/with_runtime.h disagrees with the runtime (with_arg_at, with_fs_read_file): emitted C of a std.process program does not compile #1038
Restated 2026-10-25.c444d6f made the with_* prototypes come from the With declarations, but runtime/with_runtime.h still disagrees with the runtime: with_arg_at(int32_t idx) against rt_core.w's with_arg_at(idx: isize), and with_fs_read_file(with_str path) against with_fs_read_file(path: &str). The emitted C of a five-line program that uses std.process does not compile.
Original report
Seen on the C4 branch (wo-c4 on afab485) once the compiler's C emits again (emit-c-test, emit-c-fixpoint, package-bootstrap-c all red at the cc step), and independent of C4:
out/gen/versioned_main.w:42:26: error: passing 'with_str[1]' to parameter of incompatible type 'with_str'
out/gen/versioned_main.w:44:28: error: passing 'const with_str *' to parameter of incompatible type 'with_str'
out/gen/versioned_main.w:57:27: error: passing 'const with_str *' to parameter of incompatible type 'with_str'
(18 more of the same; -ferror-limit stops at 20)
src/main.w:42-57 declare extern fn with_fs_write_file(path: &str, data: &str), with_fs_mkdir_p(path: &str), with_fs_read_file(path: &str) -> str, with_exec_argv_capture(args: &str, stdout_path: &str, stderr_path: &str, timeout_ms: i32); rt/rt_core.w:3306/3328 define them with &str (the #747 Phase C flip, 7d8d085). The C backend skips prototypes for every with_* name (CCodegen.should_emit_extern_fn_decl) on the assumption that runtime/with_runtime.h declares them — and the header still says
(header last touched d62409c). So the emitted call passes const with_str* where the header promises a by-value with_str. Either the header follows the runtime (these four and any other &str wrapper it still spells by value), or the backend stops trusting the header for with_* names whose With declaration it has (emit the prototype from the extern fn, as it now does for with_libc_*). The D30 rule applies: one ABI source, never two.
emit-c-smoke (hello world, no fs/exec calls) does not exercise these and stays green.
changed the title [-]emit-C: runtime/with_runtime.h still declares the fs/exec wrappers by value (with_str), the runtime and the compiler's externs take &str since 7d8d085e — the compiler's C does not compile[/-][+]runtime/with_runtime.h disagrees with the runtime (with_arg_at, with_fs_read_file): emitted C of a std.process program does not compile[/+]on Oct 25, 2026
Fixed on main (ae20d89): runtime/with_runtime.h declares with_str with_arg_at(int64_t idx) against rt_core.w's idx: isize, and a shared &str is the {ptr, len} view by value, the with_str itself (#1810), so with_str with_fs_read_file(with_str path) is the runtime's path: &str. Verified: a program that uses std.process (args()) and std.fs (read_file) emitted with with build --emit-c from a source checkout compiles with cc -fsyntax-only -I runtime with no error.
Activity
emit-c: with_* prototypes come from the With declarations; runtime/wi…
[-]emit-C: runtime/with_runtime.h still declares the fs/exec wrappers by value (with_str), the runtime and the compiler's externs take &str since 7d8d085e — the compiler's C does not compile[/-][+]runtime/with_runtime.h disagrees with the runtime (with_arg_at, with_fs_read_file): emitted C of a std.process program does not compile[/+]ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): reproduced in today's terms.post-release: part of the emit-C lane campaign (#955).
ehartford commentedon Nov 11, 2026
Fixed on main (ae20d89):
runtime/with_runtime.hdeclareswith_str with_arg_at(int64_t idx)againstrt_core.w'sidx: isize, and a shared&stris the{ptr, len}view by value, thewith_stritself (#1810), sowith_str with_fs_read_file(with_str path)is the runtime'spath: &str. Verified: a program that usesstd.process(args()) andstd.fs(read_file) emitted withwith build --emit-cfrom a source checkout compiles withcc -fsyntax-only -I runtimewith no error.