We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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.11.0-dev.2912+d65b42e07
I'm not confident that the title is the correct way to frame the issue. But the following code leads to compiler crash below.
// /tmp/tmp.zig test { var value: f64 = undefined; var word: u64 = undefined; @memcpy(@ptrCast([*]u8, &value), @ptrCast([*]const u8, &word)[0..@sizeOf(f64)]); // properly slicing dest does not cause the crash // @memcpy(@ptrCast([*]u8, &value)[0..@sizeOf(f64)], @ptrCast([*]const u8, &word)[0..@sizeOf(f64)]); }
$ zig version 0.11.0-dev.2912+d65b42e07 $ zig test /tmp/tmp.zig thread 72774 panic: reached unreachable code ~/projects/zig/zig/src/codegen/llvm.zig:5807:26: 0x1828d6f in sliceOrArrayLenInBytes (zig) .Many, .C => unreachable, ^ ~/projects/zig/zig/src/codegen/llvm.zig:8553:48: 0x18290a2 in airMemcpy (zig) const len = self.sliceOrArrayLenInBytes(dest_slice, dest_ptr_ty); ^ ~/projects/zig/zig/src/codegen/llvm.zig:4678:54: 0x11cfcfd in genBody (zig) .memcpy => try self.airMemcpy(inst), ^ ~/projects/zig/zig/src/codegen/llvm.zig:1232:35: 0x11c9e51 in updateFunc (zig) fg.genBody(air.getMainBody()) catch |err| switch (err) { ^ ~/projects/zig/zig/src/link/Elf.zig:2533:74: 0x11d2b2e in updateFunc (zig) if (self.llvm_object) |llvm_object| return llvm_object.updateFunc(module, func, air, liveness); ^ ~/projects/zig/zig/src/link.zig:578:77: 0xf0794d in updateFunc (zig) .elf => return @fieldParentPtr(Elf, "base", base).updateFunc(module, func, air, liveness), ^ ~/projects/zig/zig/src/Module.zig:4383:37: 0xcca74c in ensureFuncBodyAnalyzed (zig) comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) { ^ ~/projects/zig/zig/src/Compilation.zig:3127:42: 0xcc7c5d in processOneJob (zig) module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) { ^ ~/projects/zig/zig/src/Compilation.zig:3064:30: 0xb5961e in performAllTheWork (zig) try processOneJob(comp, work_item, main_progress_node); ^ ~/projects/zig/zig/src/Compilation.zig:2020:31: 0xb5596d in update (zig) try comp.performAllTheWork(main_progress_node); ^ ~/projects/zig/zig/src/main.zig:3820:24: 0xb87104 in updateModule (zig) try comp.update(main_progress_node); ^ ~/projects/zig/zig/src/main.zig:3255:17: 0x9f397e in buildOutputType (zig) updateModule(comp) catch |err| switch (err) { ^ ~/projects/zig/zig/src/main.zig:273:31: 0x9c4806 in mainArgs (zig) return buildOutputType(gpa, arena, args, .zig_test); ^ ~/projects/zig/zig/src/main.zig:211:20: 0x9c3a85 in main (zig) return mainArgs(gpa, arena, args); ^ ~/projects/zig/zig/lib/std/start.zig:609:37: 0x9c63a4 in main (zig) const result = root.main() catch |err| { ^ Aborted
no crash. i would expect this to compile as dest is allowed to be a multiptr in the docs.
The text was updated successfully, but these errors were encountered:
@memcpy(many_ptr, "hey")
llvm: fix @memcpy with dest many pointer
@memcpy
3d2fdd9
Closes ziglang#15513
9dcf57d
ce644e0
Sema: ensure dest ptr of memcpy has length
5e39b26
ab5a72f
No branches or pull requests
Zig Version
0.11.0-dev.2912+d65b42e07
Steps to Reproduce and Observed Behavior
I'm not confident that the title is the correct way to frame the issue. But the following code leads to compiler crash below.
Expected Behavior
no crash. i would expect this to compile as dest is allowed to be a multiptr in the docs.
The text was updated successfully, but these errors were encountered: