We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This issue prevents us from building Mach's Entity Component System with the new self-hosted compiler. hexops/mach#180
0.10.0-dev.3891+6a62a15ec (aarch64-macos)
main.zig:
main.zig
const std = @import("std"); fn NamespacedComponents(comptime modules: anytype) type { return @Type(.{ .Struct = .{ .layout = .Auto, .is_tuple = false, .fields = &.{.{ .name = "components", .field_type = @TypeOf(modules.components), .default_value = null, .is_comptime = false, .alignment = @alignOf(@TypeOf(modules.components)), }}, .decls = &[_]std.builtin.Type.Declaration{}, }, }); } fn namespacedComponents(comptime modules: anytype) NamespacedComponents(modules) { var x: NamespacedComponents(modules) = undefined; x.components = modules.components; return x; } pub fn World(comptime modules: anytype) type { const all_components = namespacedComponents(modules); _ = all_components; return struct {}; } pub fn main() !void { _ = World(.{ .components = .{ .location = struct {}, }, }); }
Program compiles
% zig build-exe main.zig thread 603970 panic: reached unreachable code /Users/slimsag/Desktop/zig/src/Sema.zig:24753:29: 0x1010b2127 in beginComptimePtrMutation (zig) else => unreachable, ^ /Users/slimsag/Desktop/zig/src/Sema.zig:24312:47: 0x1010af2d7 in storePtrVal (zig) var mut_kit = try beginComptimePtrMutation(sema, block, src, ptr_val, operand_ty); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:24238:33: 0x100e6837b in storePtr2 (zig) try sema.storePtrVal(block, src, ptr_val, operand_val, elem_ty); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:4476:67: 0x1010995eb in zirStoreNode (zig) return sema.storePtr2(block, src, ptr, src, operand, src, if (is_ret) .ret_ptr else .store); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:1049:38: 0x100e5e13f in analyzeBodyInner (zig) try sema.zirStoreNode(block, inst); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:609:30: 0x100e5062f in analyzeBody (zig) _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Sema.zig:6057:33: 0x10128ff17 in analyzeCall (zig) sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Sema.zig:5595:28: 0x1010117e3 in zirCall (zig) return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:725:62: 0x100e51eab in analyzeBodyInner (zig) .call => try sema.zirCall(block, inst), ^ /Users/slimsag/Desktop/zig/src/Sema.zig:609:30: 0x100e5062f in analyzeBody (zig) _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Sema.zig:6057:33: 0x10128ff17 in analyzeCall (zig) sema.analyzeBody(&child_block, fn_info.body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Sema.zig:5595:28: 0x1010117e3 in zirCall (zig) return sema.analyzeCall(block, func, func_src, call_src, modifier, ensure_result_used, resolved_args, bound_arg_src); ^ /Users/slimsag/Desktop/zig/src/Sema.zig:725:62: 0x100e51eab in analyzeBodyInner (zig) .call => try sema.zirCall(block, inst), ^ /Users/slimsag/Desktop/zig/src/Sema.zig:609:30: 0x100e5062f in analyzeBody (zig) _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Module.zig:5570:21: 0x100cb871b in analyzeFnBody (zig) sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Module.zig:4271:40: 0x100aeee6f in ensureFuncBodyAnalyzed (zig) var air = mod.analyzeFnBody(func, sema_arena) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Compilation.zig:2976:42: 0x100aed5eb in processOneJob (zig) module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/Compilation.zig:2914:30: 0x100a0441f in performAllTheWork (zig) try processOneJob(comp, work_item); ^ /Users/slimsag/Desktop/zig/src/Compilation.zig:2254:31: 0x100a01353 in update (zig) try comp.performAllTheWork(main_progress_node); ^ /Users/slimsag/Desktop/zig/src/main.zig:3348:20: 0x100a27183 in updateModule (zig) try comp.update(); ^ /Users/slimsag/Desktop/zig/src/main.zig:3022:17: 0x1007f64ff in buildOutputType (zig) updateModule(gpa, comp, hook) catch |err| switch (err) { ^ /Users/slimsag/Desktop/zig/src/main.zig:230:31: 0x100784dff in mainArgs (zig) return buildOutputType(gpa, arena, args, .{ .build = .Exe }); ^ /Users/slimsag/Desktop/zig/src/stage1.zig:48:24: 0x100784547 in main (zig) stage2.mainArgs(gpa, arena, args) catch unreachable; ^ ???:?:?: 0x10d42d0f3 in ??? (???) ???:?:?: 0x49467fffffffffff in ??? (???)
The text was updated successfully, but these errors were encountered:
Sema: handle empty_struct_value in beginComptimePtrMutation
8c428d8
Closes ziglang#12794
676abc8
de24cea
a0a1d00
No branches or pull requests
This issue prevents us from building Mach's Entity Component System with the new self-hosted compiler. hexops/mach#180
Zig Version
0.10.0-dev.3891+6a62a15ec (aarch64-macos)
Steps to Reproduce
main.zig:Expected Behavior
Program compiles
Actual Behavior
The text was updated successfully, but these errors were encountered: