Skip to content

Build.zig: create: debug_stack_frames_count is uninitialized #24907

@CorruptedVor

Description

@CorruptedVor

Zig Version

master (07e7cfa)

Steps to Reproduce and Observed Behavior

this is an issue because Build/Step.zig uses it to alloc something

const addresses = arena.alloc(usize, options.owner.debug_stack_frames_count) catch @panic("OOM");

triggers a valgrind warnings in the test suite:

 74 69/74 Build.Step.Options.decltest.Options...==13996== Conditional jump or move depends on uninitialised value(s)
 75 ==13996==    at 0x10C40CC: math.mul__anon_11976 (math.zig:562)
 76 ==13996==    by 0x112A9EC: mem.Allocator.allocWithSizeAndAlignment__anon_28635 (Allocator.zig:268)
 77 ==13996==    by 0x11D5797: allocAdvancedWithRetAddr (Allocator.zig:257)
 78 ==13996==    by 0x11D5797: mem.Allocator.alloc__anon_121063 (Allocator.zig:181)
 79 ==13996==    by 0x11B3ACD: Build.Step.init (Step.zig:224)
 80 ==13996==    by 0x11AF230: Build.create (Build.zig:290)
 81 ==13996==    by 0x11AC5EC: Build.Step.Options.decltest.Options (Options.zig:555)
 82 ==13996==    by 0x1115E8A: test_runner.mainTerminal (test_runner.zig:218)
 83 ==13996==    by 0x110FE81: test_runner.main (test_runner.zig:66)
 84 ==13996==    by 0x110F61D: callMain (start.zig:618)
 85 ==13996==    by 0x110F61D: callMainWithArgs (start.zig:587)
 86 ==13996==    by 0x110F61D: main (start.zig:602)

additional context: #24833 (comment)

Expected Behavior

debug_stack_frames_count is initialized, not triggering any valgrind warnings in the test suite

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions