Skip to content

build-lib with emit-h is crashing for particular input file #22405

@arkadiuszwojcik

Description

@arkadiuszwojcik

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

I have simple test.zig file and would like to export (emit H file) following function:

const std = @import("std");

export fn memset(dest: [*]u8, ch: c_int, count: usize) [*]u8 {
    @memset(dest[0..count], @intCast(ch));
    return dest;
}

I am using following command:
zig build-lib -ODebug -Mroot=D:\test\test.zig -femit-h

The process is crashing? (console output is strange) and doesn't emit H file. No error is displayed. I am using Windows machine.

When I try same command but without -femit-h then everyting is working (zig lib is generated):
zig build-lib -ODebug -Mroot=D:\test\test.zig

When I use -femit-h for simpler test.zig it works fine and H file is generated. Example test.zig that works fine:

const std = @import("std");

export fn my_max(a: u32, b: u32) u32 {
    return @max(a, b);
}

export fn my_min(a: u32, b: u32) u32 {
    return @min(a, b);
}

Expected Behavior

H file should be emited or minigful error (if not possible) should be displayed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions