Skip to content

Index Out of Bounds Panic Hit with std.Progress #20262

@haydenridd

Description

@haydenridd

Zig Version

0.14.0-dev.15+d4bc64038

Steps to Reproduce and Observed Behavior

See forked branch with fixes to update_cpu_features.zig:
https://github.com/haydenridd/zig/tree/fix-update-cpu-features

I made changes to this utility to get it to compile and run with the new std.Progress API. It's a relatively simple use of the API, and as far as I can tell I'm calling everything correctly. Compile + run not in single threaded mode with llvm-tblgen corresponding to 18.1.7 (version corresponding to issue's Zig version). Process runs for a time, and then an error like so will occur:

thread 28332 panic: index out of bounds: index 40, len 39
/home/hayden/Documents/zig/zig/build/stage3/lib/zig/std/Progress.zig:1054:40: 0x10e386e in computeRedraw (update_cpu_features)
        const children_node = &children[@intFromEnum(parent_index)];
                                       ^
/home/hayden/Documents/zig/zig/build/stage3/lib/zig/std/Progress.zig:463:40: 0x10c9bf7 in updateThreadRun (update_cpu_features)
        const buffer, _ = computeRedraw(&serialized_buffer);
                                       ^
/home/hayden/Documents/zig/zig/build/stage3/lib/zig/std/Thread.zig:408:13: 0x10a96ca in callFn__anon_8874 (update_cpu_features)
            @call(.auto, f, args);
            ^m-tblgen
/home/hayden/Documents/zig/zig/build/stage3/lib/zig/std/Thread.zig:1226:30: 0x109ed07 in entryFn (update_cpu_features)
                return callFn(f, self.fn_args);
                             ^
/home/hayden/Documents/zig/zig/build/stage3/lib/zig/c.zig:239:13: 0x1163c00 in clone (c)
            asm volatile (
            ^m-tblgen
???:?:?: 0x0 in ??? (???)
Aborted (core dumped)

This utility runs to completion when compiled in single threaded mode, however NO progress prompts are printed at all, which is suspicious...

Expected Behavior

Expected update_cpu_features.zig to run to completion successfully with no std.Progress related errors!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions