Skip to content

std lib test suite is not valgrind clean #24753

@andrewrk

Description

@andrewrk

Example of how to reproduce:

$ stage3/bin/zig test ../lib/std/std.zig  -lc -fllvm -femit-bin=test -target x86_64-native
$ valgrind ./test

Just a few examples (there are many more):

==1589188== Use of uninitialised value of size 8
==1589188==    at 0x2956983: memcpy (memcpy.zig:0)
==1589188==    by 0x24BDB5F: multi_array_list.MultiArrayList(zig.Ast.TokenList__struct_289020).setCapacity (multi_array_list.zig:472)
==1589188==    by 0x24B3B3C: multi_array_list.MultiArrayList(zig.Ast.TokenList__struct_289020).ensureTotalCapacity (multi_array_list.zig:424)
==1589188==    by 0x24B3AB0: multi_array_list.MultiArrayList(zig.Ast.TokenList__struct_289020).ensureUnusedCapacity (multi_array_list.zig:447)
==1589188==    by 0x24B3B95: multi_array_list.MultiArrayList(zig.Ast.TokenList__struct_289020).append (multi_array_list.zig:253)
==1589188==    by 0x24B15C9: zig.Ast.parse (Ast.zig:156)
==1589188==    by 0x2684083: Build.Step.Options.decltest.Options (Options.zig:682)
==1589188==    by 0x155656A: test_runner.mainTerminal (test_runner.zig:218)
==1589188==    by 0x1550791: test_runner.main (test_runner.zig:66)
==1589188==    by 0x154FF2D: callMain (start.zig:618)
==1589188==    by 0x154FF2D: callMainWithArgs (start.zig:587)
==1589188==    by 0x154FF2D: main (start.zig:602)

==1589188== Use of uninitialised value of size 8
==1589188==    at 0x24B6BEA: zig.Parse.tokenTag (Parse.zig:15)
==1589188==    by 0x24D7403: zig.Parse.parseTypeExpr (Parse.zig:1923)
==1589188==    by 0x24C0F15: zig.Parse.expectTypeExpr (Parse.zig:1962)
==1589188==    by 0x24DB111: zig.Parse.parseVarDeclProto (Parse.zig:769)
==1589188==    by 0x24DBD64: zig.Parse.parseGlobalVarDecl (Parse.zig:835)
==1589188==    by 0x24DCD49: zig.Parse.expectTopLevelDecl (Parse.zig:648)
==1589188==    by 0x24C1C8C: zig.Parse.expectTopLevelDeclRecoverable (Parse.zig:659)
==1589188==    by 0x24B5864: zig.Parse.parseContainerMembers (Parse.zig:353)
==1589188==    by 0x24B4351: zig.Parse.parseRoot (Parse.zig:199)
==1589188==    by 0x24B17EE: zig.Ast.parse (Ast.zig:184)
==1589188==    by 0x2684083: Build.Step.Options.decltest.Options (Options.zig:682)
==1589188==    by 0x155656A: test_runner.mainTerminal (test_runner.zig:218)

==1589188== Use of uninitialised value of size 8
==1589188==    at 0x15550FF: heap.debug_allocator.DebugAllocator(.{ .stack_trace_frames = 10, .enable_memory_limit = false, .safety = true, .thread_safe = true, .MutexType = null, .never_unmap = false, .retain_metadata = false, .verbose_log = false, .backing_allocator_zeroes = true, .resize_stack_traces = true, .canary = 2824291834806075834, .page_size = 131072 }).free (debug_allocator.zig:937)
==1589188==    by 0x14F846B: rawFree (Allocator.zig:147)
==1589188==    by 0x14F846B: heap.arena_allocator.ArenaAllocator.deinit (arena_allocator.zig:60)
==1589188==    by 0x26840E9: Build.Step.Options.decltest.Options (Options.zig:536)
==1589188==    by 0x155656A: test_runner.mainTerminal (test_runner.zig:218)
==1589188==    by 0x1550791: test_runner.main (test_runner.zig:66)
==1589188==    by 0x154FF2D: callMain (start.zig:618)
==1589188==    by 0x154FF2D: callMainWithArgs (start.zig:587)
==1589188==    by 0x154FF2D: main (start.zig:602)


==1589188== Conditional jump or move depends on uninitialised value(s)
==1589188==    at 0x158A63C: testing.expectEqualSlices__anon_35769 (testing.zig:368)
==1589188==    by 0x2809019: os.linux.IoUring.test.ring mapped buffers recv (IoUring.zig:4194)
==1589188==    by 0x155656A: test_runner.mainTerminal (test_runner.zig:218)
==1589188==    by 0x1550791: test_runner.main (test_runner.zig:66)
==1589188==    by 0x154FF2D: callMain (start.zig:618)
==1589188==    by 0x154FF2D: callMainWithArgs (start.zig:587)
==1589188==    by 0x154FF2D: main (start.zig:602)

==1589188== Conditional jump or move depends on uninitialised value(s)
==1589188==    at 0x251F0E5: math.big.int.llaccum__anon_1297017 (int.zig:3611)
==1589188==    by 0x251BB84: math.big.int.llmulaccKaratsuba__anon_1296380 (int.zig:3531)
==1589188==    by 0x2513F3A: math.big.int.llmulacc__anon_1295371 (int.zig:3404)
==1589188==    by 0x286B34F: math.big.int.Mutable.mulWrapNoAlias (int.zig:875)
==1589188==    by 0x286ADEA: math.big.int.Managed.mulWrap (int.zig:3122)
==1589188==    by 0x286E490: math.big.int_test.test.mulWrap large (int_test.zig:1549)
==1589188==    by 0x155656A: test_runner.mainTerminal (test_runner.zig:218)
==1589188==    by 0x1550791: test_runner.main (test_runner.zig:66)
==1589188==    by 0x154FF2D: callMain (start.zig:618)
==1589188==    by 0x154FF2D: callMainWithArgs (start.zig:587)
==1589188==    by 0x154FF2D: main (start.zig:602)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions