#Native x86 backend: 'error: TODO: implement packed store of u352' on function declaration

1 messages · Page 1 of 1 (latest)

full heron
#

In one of my projects, I'm encountering this error message when I try to compile with the native x86 backend.
I've hit compiler TODOs before, and can usually work around them, but this one I do not understand.

$ zig build -Duse-llvm=false
install
└─ install Gfx-Project
   └─ zig build-exe Gfx-Project Debug native 1 errors
src/wl_msg.zig:207:1: error: TODO: implement packed store of u352
fn write_control_msg(sock: std.posix.fd_t, msg_bytes: []const u8, fd: std.posix.fd_t) !void {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've confirmed this happens with multiple dev builds of 0.14.0, including current master.
My program builds and works just fine with the LLVM backend.

I don't quite understand why the function is being reported as a u352 in the error

Any guidance or tips on understanding/diagnosing the issue would be much appreciated!

vagrant rune
#

could there be a packed struct used in the function? if it's 352 bits in size that could be the problem. not sure.

sharp laurel
#

The reason it's being reported on the fn declaration is just a quirk of the compiler. In general, backends shouldn't need to emit compilation errors like this, so by the time this TODO is reported, precise source location information has been thrown away. The error is just happening somewhere in that function

full heron
#

I have one packed struct in use in the function, and tried a compile log to check the size of it:

Compile Log Output:
@as(*const [22:0]u8, "size: {d}bytes {d}bits"), @as(struct { comptime comptime_int = 64, comptime comptime_int = 512 }, .{ 64, 512 })
vagrant rune
#

are you checking bits with @bitSizeOf() or sizeOf * 8? (and it could be one of the fields)

sharp laurel
#

Yeah, it'll probably be that or something within that. It's very rare to need a packed struct bigger than ~64 bits -- what's your use case here?

full heron
full heron
vagrant rune
#

you might want an extern struct instead

full heron
#

ah ok, the issue is the extra padding in the struct getting generated at comptime

full heron
#

ok, fixed the padding calculation, and all is working now!