UEFI File.getInfo() alignment error

Hi everyone!

I am pretty new to Zig, and I am using version 0.15.0-dev.1034+bd97b6618.

I have been fiddling around UEFI and Zig kinda makes things a lot more approachable because of cross-compilation. But I am getting an error while running my code that tries to use File.getInfo(). Here is an example of what I am doing and don’t mind my messy code:

        const file_size = root_dir.getInfoSize(uefi.protocol.File.Info.file) catch {
            return uefi.Status.aborted;
        };

        var info_buf: [83]u8 = undefined;
        const result = uefi.system_table.boot_services.?.allocatePool(
            .loader_data,
            file_size,
            @alignCast(@ptrCast(&info_buf)),
        );

        if (result != uefi.Status.success) {
            return uefi.Status.aborted;
        }

        _ = root_dir.getInfo(
            uefi.protocol.File.Info.file,
            &info_buf,
        ) catch {
            return uefi.Status.aborted;
        };

I try to compile and I get a pointer alignment error inside the /usr/lib/zig/lib/std/os/uefi/protocol/file.zig file, related to the standard library.

$ zig build
install
└─ install main
   └─ compile exe main Debug x86_64-uefi-msvc 1 errors
/usr/lib/zig/lib/std/os/uefi/protocol/file.zig:228:47: error: @ptrCast increases pointer alignment
            .success => return @as(*InfoType, @ptrCast(buffer.ptr)),
                                              ^~~~~~~~~~~~~~~~~~~~
/usr/lib/zig/lib/std/os/uefi/protocol/file.zig:228:62: note: '[*]u8' has alignment '1'
            .success => return @as(*InfoType, @ptrCast(buffer.ptr)),
                                                       ~~~~~~^~~~
/usr/lib/zig/lib/std/os/uefi/protocol/file.zig:228:47: note: '*os.uefi.protocol.file.File.Info.File' has alignment '8'
/usr/lib/zig/lib/std/os/uefi/protocol/file.zig:228:47: note: use @alignCast to assert pointer alignment
referenced by:
    main: src/main.zig:127:29
    EfiMain: /usr/lib/zig/lib/std/start.zig:219:42
    3 reference(s) hidden; use '-freference-trace=5' to see all references

Now, it could totally an issue of mine, but wouldn’t the error occur on my own code? Is this a bug of mine or is it something wrong in the standard library? Since the build is from the main branch, I agree that there could be some errors. And I don’t mind opening an issue on Github, but I would prefer to actually understand if this is really an error on the Zig’s standard library first.

Thanks