verbose_air: enable emit_bin so exported functions produce AIR

With emit_bin=false, the compiler never queued functions for analysis,
making the verbose_air_callback a no-op — all corpus files produced 0
AIR functions on both C and Zig sides, so Stage 3 comparison was
vacuous.

Set emit_bin=true so that `export fn` and `@export` trigger function
analysis. Disable 5 compiler_rt corpus files that now expose the
Zig-vs-C mismatch (they use @export but C sema doesn't port zirFunc
yet). Add 3 skipped export-fn test tiers in sema_test.zig as targets
for incremental zirFunc porting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 07:22:20 +00:00
parent e3901a774a
commit ac0bb1eec5
3 changed files with 24 additions and 6 deletions

View File

@@ -168,7 +168,7 @@ fn zigCompileAirImpl(
.output_mode = .Obj,
.resolved_target = resolved_target,
.have_zcu = true,
.emit_bin = false,
.emit_bin = true,
.is_test = false,
});

View File

@@ -370,3 +370,21 @@ test "sema: Air raw C vs Zig comparison (empty)" {
test "sema: Air raw C vs Zig comparison (const)" {
try semaAirRawCheck("const x = 0;");
}
// Tier 1-3: export fn tests — initially skipped until C sema ports zirFunc.
// Remove `return error.SkipZigTest;` as each tier is ported.
test "sema air: empty void function" {
if (true) return error.SkipZigTest;
try semaAirRawCheck("export fn f() void {}");
}
test "sema air: return integer" {
if (true) return error.SkipZigTest;
try semaAirRawCheck("export fn f() u32 { return 42; }");
}
test "sema air: identity function" {
if (true) return error.SkipZigTest;
try semaAirRawCheck("export fn f(x: u32) u32 { return x; }");
}

View File

@@ -97,11 +97,11 @@ const corpus_files = .{
"../lib/std/crypto/codecs.zig", // 165
"../lib/std/os/uefi/tables/table_header.zig", // 214
"../lib/std/zig/llvm.zig", // 247
"../lib/compiler_rt/neghf2.zig", // 265
"../lib/compiler_rt/negxf2.zig", // 265
"../lib/compiler_rt/absvdi2.zig", // 311
"../lib/compiler_rt/absvsi2.zig", // 311
"../lib/compiler_rt/absvti2.zig", // 314
//"../lib/compiler_rt/neghf2.zig", // 265 -- disabled: @export produces Zig AIR, C sema not yet ported
//"../lib/compiler_rt/negxf2.zig", // 265 -- disabled: @export produces Zig AIR, C sema not yet ported
//"../lib/compiler_rt/absvdi2.zig", // 311 -- disabled: @export produces Zig AIR, C sema not yet ported
//"../lib/compiler_rt/absvsi2.zig", // 311 -- disabled: @export produces Zig AIR, C sema not yet ported
//"../lib/compiler_rt/absvti2.zig", // 314 -- disabled: @export produces Zig AIR, C sema not yet ported
//"../lib/compiler_rt/addhf3.zig", // 319
//"../lib/compiler_rt/addxf3.zig", // 323
//"../lib/compiler_rt/mulhf3.zig", // 323