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
0.14.0-dev.2578+ec60156f1
(I guess it's a dupe, but wasn't able to find the other report)
fn compute(x: u8) u32 { const table: []const u32 = comptime table: { var t: [128]u32 = undefined; t['1'] = 123; // can be removed, still crashes break :table &t; }; return table[x]; } const std = @import("std"); test { try std.testing.expectEqual(123, compute('1')); }
crashes both with zig-out/bin/zig test repro.zig -fno-llvm and zig-out/bin/zig test repro.zig. also crashes with zig 0.13.0.
zig-out/bin/zig test repro.zig -fno-llvm
zig-out/bin/zig test repro.zig
zig 0.13.0
thread 146390 panic: reached unreachable code /var/home/xavier/src/zig/zig/src/codegen.zig:679:56: 0x229d2e0 in lowerPtr (zig) .arr_elem, .comptime_field, .comptime_alloc => unreachable, ^ /var/home/xavier/src/zig/zig/src/codegen.zig:330:37: 0x1e8b9e4 in generateSymbol (zig) .ptr => switch (try lowerPtr(bin_file, pt, src_loc, val.toIntern(), code, reloc_parent, 0)) { ^ /var/home/xavier/src/zig/zig/src/codegen.zig:335:39: 0x1e8ba69 in generateSymbol (zig) switch (try generateSymbol(bin_file, pt, src_loc, Value.fromInterned(slice.ptr), code, reloc_parent)) { ^ /var/home/xavier/src/zig/zig/src/link/Elf/ZigObject.zig:1741:43: 0x22fea71 in lowerConst (zig) const res = try codegen.generateSymbol( ^ /var/home/xavier/src/zig/zig/src/link/Elf/ZigObject.zig:1030:32: 0x22fff18 in lowerUav (zig) const res = self.lowerConst( ^ /var/home/xavier/src/zig/zig/src/link/Elf.zig:529:42: 0x2b7ad5c in lowerUav (zig) return self.zigObjectPtr().?.lowerUav(self, pt, uav, explicit_alignment, src_loc); ^ /var/home/xavier/src/zig/zig/src/link.zig:965:80: 0x2b7d1ab in lowerUav (zig) return @as(*tag.Type(), @fieldParentPtr("base", base)).lowerUav(pt, decl_val, decl_align, src_loc); ^ /var/home/xavier/src/zig/zig/src/codegen.zig:1041:23: 0x3338c17 in genTypedValue (zig) return lf.lowerUav(pt, val.toIntern(), .none, src_loc); ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:19266:45: 0x305003f in genTypedValue (zig) return switch (try codegen.genTypedValue(self.bin_file, pt, self.src_loc, val, self.target.*)) { ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:19199:53: 0x304e1d0 in resolveInst (zig) const const_mcv = try self.genTypedValue(Value.fromInterned(ip_index)); ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:5936:43: 0x3bede0b in genSliceElemPtr (zig) const slice_mcv = try self.resolveInst(lhs); ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:5980:50: 0x3bee8e3 in airSliceElemVal (zig) const elem_ptr = try self.genSliceElemPtr(bin_op.lhs, bin_op.rhs); ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:2464:61: 0x389fbf3 in genBody (zig) .slice_elem_val => try self.airSliceElemVal(inst), ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:2098:25: 0x34b2cf9 in gen (zig) try self.genBody(self.air.getMainBody()); ^ /var/home/xavier/src/zig/zig/src/arch/x86_64/CodeGen.zig:928:17: 0x31f681d in generate (zig) function.gen() catch |err| switch (err) { ^ /var/home/xavier/src/zig/zig/src/codegen.zig:81:51: 0x2df1b1a in generateFunction (zig) return importBackend(backend).generate(lf, pt, src_loc, func_index, air, liveness, code, debug_output); ^ /var/home/xavier/src/zig/zig/src/link/Elf/ZigObject.zig:1431:45: 0x2df2b0c in updateFunc (zig) const res = try codegen.generateFunction( ^ /var/home/xavier/src/zig/zig/src/link/Elf.zig:2333:44: 0x2df43ea in updateFunc (zig) return self.zigObjectPtr().?.updateFunc(self, pt, func_index, air, liveness); ^ /var/home/xavier/src/zig/zig/src/link.zig:725:82: 0x29f8bc6 in updateFunc (zig) return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, air, liveness); ^ /var/home/xavier/src/zig/zig/src/Zcu/PerThread.zig:1550:22: 0x2600e7c in linkerUpdateFunc (zig) lf.updateFunc(pt, func_index, air, liveness) catch |err| switch (err) { ^ /var/home/xavier/src/zig/zig/src/link.zig:1550:32: 0x21f947e in doTask (zig) pt.linkerUpdateFunc(func.func, func.air) catch |err| switch (err) { ^ /var/home/xavier/src/zig/zig/src/link.zig:1381:34: 0x1e14910 in flushTaskQueue (zig) for (tasks) |task| doTask(comp, tid, task); ^ /var/home/xavier/src/zig/zig/lib/std/Thread/Pool.zig:178:50: 0x1e14991 in runFn (zig) @call(.auto, func, .{id.?} ++ closure.arguments); ^ /var/home/xavier/src/zig/zig/lib/std/Thread/Pool.zig:291:32: 0x1dc826d in worker (zig) run_node.data.runFn(&run_node.data, id); ^ /var/home/xavier/src/zig/zig/lib/std/Thread.zig:486:13: 0x1baae9a in callFn__anon_178150 (zig) @call(.auto, f, args); ^ /var/home/xavier/src/zig/zig/lib/std/Thread.zig:755:30: 0x19de302 in entryFn (zig) return callFn(f, args_ptr.*);
with llvm:
thread 147705 panic: reached unreachable code /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:4484:60: 0x1eb5da5 in lowerPtr (zig) .arr_elem, .comptime_field, .comptime_alloc => unreachable, ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:4025:35: 0x1c08de3 in lowerValue (zig) .ptr => try o.lowerPtr(arg_val, 0), ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:4027:33: 0x1c0a8e6 in lowerValue (zig) try o.lowerValue(slice.ptr), ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:5018:42: 0x2dfff81 in resolveValue (zig) const llvm_val = try o.lowerValue(val.toIntern()); ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:5009:47: 0x2dffd1f in resolveInst (zig) const llvm_val = try self.resolveValue((try self.air.value(inst, self.ng.object.pt)).?); ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:7041:43: 0x2e5c291 in airSliceElemVal (zig) const slice = try self.resolveInst(bin_op.lhs); ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:5262:64: 0x29f6224 in genBody (zig) .slice_elem_val => try self.airSliceElemVal(body[i..]), ^ /var/home/xavier/src/zig/zig/src/codegen/llvm.zig:1764:19: 0x29ed650 in updateFunc (zig) fg.genBody(air.getMainBody(), .poi) catch |err| switch (err) { ^ /var/home/xavier/src/zig/zig/src/link/Elf.zig:2332:70: 0x2df4394 in updateFunc (zig) if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(pt, func_index, air, liveness); ^ /var/home/xavier/src/zig/zig/src/link.zig:725:82: 0x29f8bc6 in updateFunc (zig) return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(pt, func_index, air, liveness);
working code or error message
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Zig Version
0.14.0-dev.2578+ec60156f1
Steps to Reproduce and Observed Behavior
(I guess it's a dupe, but wasn't able to find the other report)
crashes both with
zig-out/bin/zig test repro.zig -fno-llvm
andzig-out/bin/zig test repro.zig
.also crashes with
zig 0.13.0
.with llvm:
Expected Behavior
working code or error message
The text was updated successfully, but these errors were encountered: