Skip to content

linux seed legs: char pointers are c_char, va_list never decays, the SDK gunzip helper uses std.zlib - #2586

Merged
ehartford merged 3 commits into
mainfrom
charptr
Oct 23, 2026
Merged

ehartford merged 3 commits into
mainfrom
charptr

Conversation

@ehartford

@ehartford ehartford commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Three fixes the linux-x86_64 and linux-aarch64 seed legs (#2582) found; each verified on the host that failed.

  1. A pointer to C's char is *const c_char / *mut c_char (§16.1, c_import lays out C's long as 64 bits on Windows: the C type aliases are hardcoded to arm64 macOS #2176). The clang bridge spelled the pointee i8 while the scalar was c_char and the alias is u8 on AArch64 Linux: c-migrator-core-tests (check-macro-unsigned-minus) and c-migrator-basic-tests (build-member, an ICE) were red there. Char_U classifies as unsigned where it is. A selfhost case pins the spellings. Verified in the arm64 container.
  2. A va_list never decays. On x86_64 Linux it is __va_list_tag[1], so the migrator decayed vsnprintf(..., args) to &args[0] as *mut __va_list_tag, indexing the opaque c_va_list (build-vacopy). Verified on eric-5090.
  3. The SDK gunzip helper (build/zlib_gunzip.w) uses std.zlib, never std.engines.zlib.*. It is compiled by the pinned seed; naming the tree's corpus modules made it uncompilable under the local-3 Linux and Windows seeds once STC corpus (std.stc) and its test lanes: stdlib_sourcing_plan Phase 3, the pipeline half #2556 re-promoted zlib with union zeroed() (corpus-c-model and a fresh host's :deps red). Verified under the local-3 seed on eric-5090 and the darwin seed here.

The standard library's own *const i8 C-string spelling is #2585. Stacked under issues-b (six issue fixes); the battery blesses the stack's top. Draft until green.

Eric Hartford added 2 commits October 23, 2026 11:31
….1, #2176)

The clang bridge spelled a char pointee `i8` while the scalar was `c_char`
and the per-target alias prelude made `c_char` u8 on AArch64 Linux and
wasm: three spellings of one C type. On the unsigned-char target a migrated
`*p = *q` narrowed u8 to i8 (c-migrator-core-tests'
check-macro-unsigned-minus) and a `*const i8` union field refused
`null as *const c_char` with an ICE (c-migrator-basic-tests' build-member),
both found by the linux-aarch64 seed leg (#2582). The pointee is now
`c_char`, and the bridge's signedness classifiers (is_unsigned_kind,
with_ci_type_is_unsigned, the bitfield member rule) treat Char_U as the
unsigned it is there, as #2176's alias does. `unsigned char` stays `u8`.
A migrator selfhost case pins the spellings.
…get (#1104)

On x86_64 Linux `va_list` is `__va_list_tag[1]`, an array to clang, so the
migrator's array-to-pointer decay rewrote `vsnprintf(..., args)` as
`(&args[0] as *mut __va_list_tag) as c_va_list`, indexing an opaque type
and naming a record With never emits (c-migrator-basic-tests' build-vacopy
on the linux-x86_64 seed leg, #2582; green on darwin, where va_list is a
pointer). The array-type predicate the decay sites share answers false for
a va_list, so the argument is the value itself, as on the other targets.
Verified on eric-5090 with a patched stage1: the case builds and runs.
@ehartford ehartford changed the title A pointer to C's char is a pointer to c_char, the target's alias (§16.1, #2176) linux seed legs: char pointers are c_char, va_list never decays, the SDK gunzip helper uses std.zlib Oct 23, 2026
@ehartford
ehartford added this pull request to stack #2588 October 23, 2026 18:14
…ine module

build/zlib_gunzip.w is compiled by the driver, the pinned seed, against the
tree's lib/std. It named `std.engines.zlib.defs` and `.inflate`, the
corpus modules, so the zlib re-promotion in #2556 (union `zeroed()` in
trees.w) made it uncompilable under the pinned Linux and Windows seeds
(local-3 predates union zeroed): corpus-c-model and a fresh host's `:deps`
went red on both Linux legs (#2582), while every seed's embedded `std.zlib`
compiles. The helper now inflates with `std.zlib.decompress_gzip_with_limit`,
as the corpus-reference helper (lib/std/build.w) always has, and keeps its
`decompress_gzip_to_file` contract (limits, failures, the output file's
existence) that behav_zlib_gunzip_owned pins. The whole archive is
decompressed in memory (the facade has no streaming inflate); the largest
input is the prebuilt SDK archive. Verified under the local-3 seed on
eric-5090 and the darwin seed on the laptop.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery GREEN on the stack top 077d684 (issues-b on this branch), 669 s, under the pinned seed.

@ehartford
ehartford marked this pull request as ready for review October 23, 2026 18:44
@ehartford
ehartford merged commit ebb39de into main Oct 23, 2026
@ehartford
ehartford deleted the charptr branch October 23, 2026 18:44
ehartford pushed a commit that referenced this pull request Oct 23, 2026
`(char *)"incorrect header check"` migrated to `"..." as *mut c_char`
while a char pointee was spelled `i8`: the cast survived because the
spellings differed. Once the pointee became `c_char` on both sides (#2586),
cast_if_needed dropped it as a same-type cast and zlib's `strm->msg = ...`
became a bare `str` assigned to a `*mut c_char`, refused by Sema
(zlib-build, zlib-check-generated on the linux-x86_64 and Windows seed
legs, #2582). A string literal is a `str`, never the pointer its C type
spells, so a cast to a pointer type is always kept.

(cherry picked from commit 1b5e3d8)
ehartford added a commit that referenced this pull request Oct 23, 2026
…st-specific fixtures (#2589)

* A string literal keeps its pointer cast however the pointee is spelled

`(char *)"incorrect header check"` migrated to `"..." as *mut c_char`
while a char pointee was spelled `i8`: the cast survived because the
spellings differed. Once the pointee became `c_char` on both sides (#2586),
cast_if_needed dropped it as a same-type cast and zlib's `strm->msg = ...`
became a bare `str` assigned to a `*mut c_char`, refused by Sema
(zlib-build, zlib-check-generated on the linux-x86_64 and Windows seed
legs, #2582). A string literal is a `str`, never the pointer its C type
spells, so a cast to a pointer type is always kept.

* c-migrator-basic-tests: the strtoll family asks for strtold only where long double is a double

`long double` is a double only on AArch64 Darwin and Windows (§16.1); on
x86_64 Linux it is the 80-bit type, which With has no float for, so the
fixture's `long double p4` is untranslatable there and the migration fails
loudly, as it must. The case was written on darwin; it now includes p4 and
the `strtold(` assertion only where the host has the type (the
linux-x86_64 seed leg, #2582).

* mlib-test: the multimap lines are compared without the CR Windows stdio writes

upstream's multimap example prints through C's stdio, whose text mode on
Windows ends a line with CRLF, so "Key=6 Count=1 Value=6 \n" was not found
in its output on the Windows seed leg (#2582) although the line was there.
The comparison drops the CR; the other hosts print LF and are unchanged.

---------

Co-authored-by: Eric Hartford <[email protected]>
ehartford added a commit that referenced this pull request Oct 23, 2026
…f5cc0d1 (#2590)

Cut on eric-5090 from the bridge commit 1508cf5 (seed-bridge-20261023:
f78d2c2, the darwin seed's commit, plus #2586 and the round-two leg
fixes) under the pinned local-3 driver: build, fixpoint and release-checks
green. The platform keeps its own `.version=` line: the darwin seed stays
nightly-20261023-local-1-f78d2c24f59d. Main since #2583 does not compile
under local-3 on Linux, so this is the Linux bootstrap again (#2582). The
workflow pins follow the lock (tools/bump_seed_pins.w).

Co-authored-by: Eric Hartford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant