Skip to content

Compiler crash when @memsetting member array #15634

Closed
@Srekel

Description

@Srekel

Zig Version

0.11.0-dev.3031+f40539e5d

Steps to Reproduce and Observed Behavior

This is on Windows 10.

zig init

main.zig:

pub const IdLocal = struct {
    str: [191]u8 = .{0} ** 191,

    pub fn clear(self: *IdLocal) void {
        // @memset(self.str[0..], 0); <--- this is correct and works
        @memset(self.str, 0); // <--- this yields "exit code 1"
    }
};

pub fn main() !void {
    var lol: IdLocal = undefined;
    lol.clear();
}

zig build:

PS E:\Projects\zigtesting> zig build
zig build-exe zigtesting Debug native: error: the following command exited with error code 3:
E:\Programs\zig\zig.exe build-exe E:\Projects\zigtesting\src\main.zig --cache-dir E:\Projects\zigtesting\zig-cache --global-cache-dir C:\Users\Srekel\AppData\Local\zig --name zigtesting --listen=-
Build Summary: 0/3 steps succeeded; 1 failed (disable with -fno-summary)
install transitive failure
+- install zigtesting transitive failure
+- zig build-exe zigtesting Debug native failure
error: the following build command failed with exit code 1:
E:\Projects\zigtesting\zig-cache\o\d234a84f47ea5d41edd005b7e6d7c6fb\build.exe E:\Programs\zig\zig.exe E:\Projects\zigtesting E:\Projects\zigtesting\zig-cache C:\Users\Srekel\AppData\Local\zig
PS E:\Projects\zigtesting>

Expected Behavior

PS E:\Projects\zigtesting> zig build
PS E:\Projects\zigtesting>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions