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
c_import: inline variadic va_start/va_arg body omitted; extern suggestion cannot link it #1678
While building the #1652 failure/cleanup integration fixture, a minimal inline variadic C function is omitted rather than translated:
use c_import("#include <stdarg.h>\nstatic inline int probe(int n, ...) { va_list ap; va_start(ap, n); int x = va_arg(ap, int); va_end(ap); return x; }")
fn main: print(unsafe { probe(1, 7) })
with run reports c_import symbol 'probe' was omitted: inline body translation failed, categorized as raw-modelable, and suggests a manual extern binding. That remedy cannot link this static inline definition. The reporter is src/CImport.w:1674; the precise unsupported translation branch is not yet diagnosed.
Observed with modeled-C stack stage1 based on 590aa2b (compiler source code identical to the prior 39eb1c4 iteration apart from documentation). Repro/log: modeled-c-completion/out/variadic-inline-probe.w and .log. The #1652 suite needs a controllably failing foreign setter, so this is also a fixture-tooling capability gap. Do not silently emit a fixed-arity definition or a placeholder body for a variadic function.
Related diagnostic classification work: #582. This is separate from the modeled variadic call-site work in #1652.
Ruling (Eric, 2026-09-27, "fair. I agree."): deferred, with the shape settled.
Today's behavior is correct: an inline body that uses va_start/va_arg is omitted loudly with the real reason ("va_arg is not supported"), never stubbed; calling variadic C and declaring c_va_list functions keep working.
Landed in #1844 (main 173d8aa, D75 spec v7.7): With variadic definitions (..., va_start(), ap.arg[T]() per target) and the migrator translating C variadic bodies. Evidence with the installed v0.15.3.0-g173d8aa4d: behav_variadic_definitions.w, behav_variadic_definition_target_abi.w, behav_variadic_definition_called_from_c.w, behav_migrate_variadic_definitions.w and behav_c_import_static_inline_variadic.w all pass.
Activity
ehartford commentedon Sep 27, 2026
Ruling (Eric, 2026-09-27, "fair. I agree."): deferred, with the shape settled.
va_start/va_argis omitted loudly with the real reason ("va_arg is not supported"), never stubbed; calling variadic C and declaringc_va_listfunctions keep working....trailing parameter on a With function (library-maintainer tier, never in application code), ava_startintrinsic lowered to LLVM'sllvm.va_start(the prologue spill is LLVM's/C's, no assembly), andva_arg[T](ap)expanded per target in With over thec_va_listlayouts va_list is modeled as a pointer on every target: a variadic With definition corrupts its stack on linux x86_64 (and linux aarch64) — zlib's gzprintf crashes the drift harness #1104 already models (as clang expands it). The migrator then translates such bodies.Spec text lands with the implementation. Refs #1104.
c_import: an omitted static inline body is inexpressible, and says why (
C backend and modeled-C fixes: map loops, generic structs, view compa…
Spec v7.7 (D75): once parameters, fills, distinct casts, payload disc…
Migrator and c_import translate variadic C definitions to the D75 form (
Migrator and c_import translate variadic C definitions to the D75 form (
Variadic definitions (D75): va_start()/ap.arg[T]() per target; migrat…
ehartford commentedon Sep 29, 2026
Landed in #1844 (main 173d8aa, D75 spec v7.7): With variadic definitions (
...,va_start(),ap.arg[T]()per target) and the migrator translating C variadic bodies. Evidence with the installed v0.15.3.0-g173d8aa4d: behav_variadic_definitions.w, behav_variadic_definition_target_abi.w, behav_variadic_definition_called_from_c.w, behav_migrate_variadic_definitions.w and behav_c_import_static_inline_variadic.w all pass.Sema/Codegen/migrator: unsuffixed literal arithmetic takes its contex…