Skip to content

@errorName not working on selfhosted x86-64 backend #22362

@AndrewKraevskii

Description

@AndrewKraevskii

Zig Version

0.14.0-dev.2577+271452d22

Steps to Reproduce and Observed Behavior

Compile this program on linux x86-64:

const std = @import("std");

pub fn main() !void {
    foo() catch |e| {
        const str = @errorName(e);
        std.debug.print("{s}\n", .{str});
    };
}

fn foo() !void {
    return error.OutOfMemory;
}

running selfhosted

zig run main.zig -fno-llvm -fno-lld

gives


fMemory

and running llvm backend gives

zig run main.zig
OutOfMemory

On 0.13.0 it works correctly so its regression

Expected Behavior

I expect output of first and second run to be the same (e.g. "OutOfMemory")

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-self-hostedbugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions