Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.Progress messages overwrite compiler crash reports #20156

Closed
amp-59 opened this issue Jun 1, 2024 · 4 comments
Closed

std.Progress messages overwrite compiler crash reports #20156

amp-59 opened this issue Jun 1, 2024 · 4 comments
Labels
question No questions on the issue tracker, please.

Comments

@amp-59
Copy link
Contributor

amp-59 commented Jun 1, 2024

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

Compile example program with zig build-obj cx_enum.zig ( #17570)
cx_enum.zig:

const E = enum(comptime_int) {
    message,
    reached_urneachable,
    accessed_out_of_bounds,
};
const U = union(E) {
    message: []const u8,
    reached_urneachable,
    accessed_out_of_bounds: struct { idx: usize, end: usize },
};
fn f3(u: U) noreturn {
    switch (u) {
        .message => {},
        .accessed_out_of_bounds => {},
        .reached_urneachable => {},
    }
    @trap();
}
pub fn main() void {
    f3(.{ .message = "ok" });
}

Output:

zig build-obj cx_enum.zig
[161] Semantic Analysis
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
        return self.lowerBlock(inst, null, @ptrCast(self.air.extra[extra.end..][0..extra.data.body_len]));
                              ^
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
~/.local/share/projects/all/zig/src/link.zig:422:82: 0x5d19f48 in updateFunc (zig)
                return @as(*tag.Type(), @fieldParentPtr("base", base)).updateFunc(module, func_index, air, liveness);
                                                                                 ^
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
~/.local/share/projects/all/zig/src/Compilation.zig:3406:42: 0x5aae6f8 in processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
                                         ^
~/.local/share/projects/all/zig/src/Compilation.zig:3346:30: 0x58e3848 in performAllTheWork (zig)
            try processOneJob(comp, work_item, main_progress_node);
                             ^
~/.local/share/projects/all/zig/src/Compilation.zig:2133:31: 0x58df0df in update (zig)
    try comp.performAllTheWork(main_progress_node);
                              ^
[380] Semantic Analysis
[64] Code Generation
└─ cx_enum.f3
~/.local/share/projects/all/zig/src/main.zig:3416:17: 0x597b11c in buildOutputType (zig)
    updateModule(comp, color, root_prog_node) catch |err| switch (err) {
                ^
~/.local/share/projects/all/zig/src/main.zig:271:31: 0x57c082e in mainArgs (zig)
        return buildOutputType(gpa, arena, args, .run);
                              ^
~/.local/share/projects/all/zig/src/main.zig:209:20: 0x57bdb45 in main (zig)
    return mainArgs(gpa, arena, args);
                   ^
~/.local/share/projects/all/zig/lib/std/start.zig:524:37: 0x57bd5eb in main (zig)
            const result = root.main() catch |err| {
                                    ^
???:?:?: 0x743485973ccf in ??? (libc.so.6)
Unwind information for `libc.so.6:0x743485973ccf` was not available, trace may be incomplete

Aborted

Expected Behavior

An option or environment value to specifically silence all std.Progress output would be very nice.

@amp-59 amp-59 added the bug Observed behavior contradicts documented or intended behavior label Jun 1, 2024
@mlugg
Copy link
Member

mlugg commented Jun 1, 2024

I expect this to have been fixed by #20139.

Also, 0.13.0 is not a Zig version which currently exists. Please actually follow the instructions in the issue template when creating an issue.

@amp-59
Copy link
Contributor Author

amp-59 commented Jun 1, 2024

I expect this to have been fixed by #20139.

Good. If you know that for a fact, then only my suggestion to add an option to disable std.Progress remains to be addressed.

Please actually follow the instructions

My mistake. Last time I read the instruction for 'Zig Version' on the bug issue template, it read 'The output of zig version'. I will be more careful next time.

@mlugg
Copy link
Member

mlugg commented Jun 1, 2024

If you know that for a fact [...]

I don't.

only my suggestion to add an option to disable std.Progress remains to be addressed.

That would be --color off -- although, there is no reason I can see to typically want this.

Last time I read the instruction for 'Zig Version' on the bug issue template, it read 'The output of zig version'.

It does read that. No current build of Zig should ever output 0.13.0 when running zig version. Instead, it will output a version something like this:

0.13.0-dev.351+64ef45eb0

If your build outputs 0.13.0, you have compiled Zig incorrectly.

@Vexu
Copy link
Member

Vexu commented Jun 2, 2024

If you know that for a fact [...]

I don't.

I do, it's why I removed locking stderr from #20126

@Vexu Vexu added the question No questions on the issue tracker, please. label Jun 2, 2024
@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2024
@mlugg mlugg removed the bug Observed behavior contradicts documented or intended behavior label Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question No questions on the issue tracker, please.
Projects
None yet
Development

No branches or pull requests

3 participants