Closed
Description
Zig Version
0.14.0-dev.321+888708ec8
Steps to Reproduce and Observed Behavior
Use a translate-c build step in a build script:
const translate_c = b.addTranslateC(.{
.root_source_file = b.path("src/c.h"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("c", translate_c.createModule());
thread 160006 panic: index out of bounds: index 0, len 0
/home/andy/local/lib/zig/std/Build/Step.zig:551:103: 0x1211890 in zigProcessUpdate (build)
const prefix_index: std.zig.Server.Message.PathPrefix = @enumFromInt(prefixed_path[0] - 1);
^
/home/andy/local/lib/zig/std/Build/Step.zig:441:40: 0x1214fb0 in evalZigProcess (build)
const result = try zigProcessUpdate(s, zp, watch);
^
/home/andy/local/lib/zig/std/Build/Step/TranslateC.zig:158:48: 0x11c8cc5 in make (build)
const output_path = try step.evalZigProcess(argv_list.items, prog_node, false);
^
/home/andy/local/lib/zig/std/Build/Step.zig:231:13: 0x117ae67 in make (build)
s.makeFn(s, options) catch |err| switch (err) {
^
/home/andy/local/lib/zig/compiler/build_runner.zig:1046:31: 0x112bacc in workerMakeOneStep (build)
const make_result = s.make(.{
^
/home/andy/local/lib/zig/std/Thread/Pool.zig:115:39: 0x112c461 in runFn (build)
@call(.auto, func, closure.arguments);
^
/home/andy/local/lib/zig/std/Thread/Pool.zig:291:32: 0x11ac0b5 in worker (build)
run_node.data.runFn(&run_node.data, id);
^
/home/andy/local/lib/zig/std/Thread.zig:409:13: 0x1179b7d in callFn__anon_15720 (build)
@call(.auto, f, args);
^
/home/andy/local/lib/zig/std/Thread.zig:1234:30: 0x112b197 in entryFn (build)
return callFn(f, self.fn_args);
^
/home/andy/dev/zig/lib/c.zig:239:13: 0x131eff0 in clone (c)
asm volatile (
^
Expected Behavior
No crash.
Regression caused by #20580
Related to #20630
The panic happens because the frontend fails to report file system inputs in the translate-c logic. This is a bug in the frontend, not the build system.
Should be an easy fix, just need to send a non-empty file_system_inputs
message here:
Line 4089 in 888708e