[nix-shell:~/dev/zig/build]$ valgrind ./zig test ../test/stage1/behavior.zig ==31997== Memcheck, a memory error detector ==31997== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==31997== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info ==31997== Command: ./zig test ../test/stage1/behavior.zig ==31997== Semantic Analysis [1459/2645] ==31997== Invalid read of size 8 ==31997== at 0xAB5AC9: ir_analyze_cast(IrAnalyze*, IrInst*, ZigType*, IrInstGen*) (ir.cpp:14552) ==31997== by 0xAB8311: ir_implicit_cast2(IrAnalyze*, IrInst*, IrInstGen*, ZigType*) (ir.cpp:15182) ==31997== by 0xAC81FA: ir_analyze_fn_call(IrAnalyze*, IrInst*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier, IrInstGen*, IrInst*, bool, IrInstGen**, unsigned long, IrInstGen*, ResultLoc*) (ir.cpp:19720) ==31997== by 0xAC8AE0: ir_analyze_fn_call_src(IrAnalyze*, IrInstSrcCall*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier) (ir.cpp:19844) ==31997== by 0xAC96A5: ir_analyze_instruction_call(IrAnalyze*, IrInstSrcCall*) (ir.cpp:20030) ==31997== by 0xAEDABD: ir_analyze_instruction_base(IrAnalyze*, IrInstSrc*) (ir.cpp:29793) ==31997== by 0xAEEA4F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30107) ==31997== by 0xB32E17: analyze_fn_ir(CodeGen*, ZigFn*, AstNode*) (analyze.cpp:4830) ==31997== by 0xB333C7: analyze_fn_body(CodeGen*, ZigFn*) (analyze.cpp:4946) ==31997== by 0xB33BC8: semantic_analyze(CodeGen*) (analyze.cpp:5058) ==31997== by 0xA7171E: gen_root_source(CodeGen*) (codegen.cpp:9617) ==31997== by 0xA7577A: codegen_build_and_link(CodeGen*) (codegen.cpp:10721) ==31997== Address 0x189df0b0 is 16 bytes inside a block of size 64 free'd ==31997== at 0x855F900: free (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834A9: mem::os::free(void*) (mem.hpp:62) ==31997== by 0xA82FD7: heap::CAllocator::internal_deallocate(mem::TypeInfo const&, void*, unsigned long) (heap.cpp:117) ==31997== by 0xAFDA8D: void mem::Allocator::destroy(IrInstSrcDeclRef*) (mem.hpp:127) ==31997== by 0xA84F2E: destroy_instruction_src(IrInstSrc*) (ir.cpp:470) ==31997== by 0xA85DFC: ira_deref(IrAnalyze*) (ir.cpp:753) ==31997== by 0xAEED6F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30170) ==31997== by 0xAB0B49: ir_eval_const_value(CodeGen*, Scope*, AstNode*, ZigValue*, unsigned long*, unsigned long*, ZigFn*, Buf*, AstNode*, Buf*, IrExecutableGen*, AstNode*, UndefAllowed) (ir.cpp:13179) ==31997== by 0xB27E56: analyze_const_value(CodeGen*, Scope*, AstNode*, ZigType*, Buf*, UndefAllowed) (analyze.cpp:1136) ==31997== by 0xB30721: resolve_decl_var(CodeGen*, TldVar*, bool) (analyze.cpp:3987) ==31997== by 0xB3112D: resolve_top_level_decl(CodeGen*, Tld*, AstNode*, bool) (analyze.cpp:4179) ==31997== by 0xACF151: ir_analyze_decl_ref(IrAnalyze*, IrInst*, Tld*) (ir.cpp:21564) ==31997== Block was alloc'd at ==31997== at 0x85609A2: calloc (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834E4: mem::os::calloc(unsigned long, unsigned long) (mem.hpp:72) ==31997== by 0xA82EBF: heap::CAllocator::internal_allocate(mem::TypeInfo const&, unsigned long) (heap.cpp:88) ==31997== by 0xB07282: IrInstSrcDeclRef* mem::Allocator::create() (mem.hpp:122) ==31997== by 0xAFA2C6: IrInstSrcDeclRef* ir_create_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1964) ==31997== by 0xAF3A8E: IrInstSrcDeclRef* ir_build_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1998) ==31997== by 0xA8DB8F: ir_build_decl_ref(IrBuilderSrc*, Scope*, AstNode*, Tld*, LVal) (ir.cpp:4305) ==31997== by 0xA9365A: ir_gen_symbol(IrBuilderSrc*, Scope*, AstNode*, LVal, ResultLoc*) (ir.cpp:5956) ==31997== by 0xAA4C91: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9941) ==31997== by 0xAA56F4: ir_gen_node_extra(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:10085) ==31997== by 0xA93904: ir_gen_field_access(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:6011) ==31997== by 0xAA4DE1: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9962) ==31997== ==31997== Invalid read of size 8 ==31997== at 0xAAF0C2: ir_const(IrAnalyze*, IrInst*, ZigType*) (ir.cpp:12645) ==31997== by 0xAAF236: ir_resolve_cast(IrAnalyze*, IrInst*, IrInstGen*, ZigType*, CastOp) (ir.cpp:12673) ==31997== by 0xAB5BC2: ir_analyze_cast(IrAnalyze*, IrInst*, ZigType*, IrInstGen*) (ir.cpp:14569) ==31997== by 0xAB8311: ir_implicit_cast2(IrAnalyze*, IrInst*, IrInstGen*, ZigType*) (ir.cpp:15182) ==31997== by 0xAC81FA: ir_analyze_fn_call(IrAnalyze*, IrInst*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier, IrInstGen*, IrInst*, bool, IrInstGen**, unsigned long, IrInstGen*, ResultLoc*) (ir.cpp:19720) ==31997== by 0xAC8AE0: ir_analyze_fn_call_src(IrAnalyze*, IrInstSrcCall*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier) (ir.cpp:19844) ==31997== by 0xAC96A5: ir_analyze_instruction_call(IrAnalyze*, IrInstSrcCall*) (ir.cpp:20030) ==31997== by 0xAEDABD: ir_analyze_instruction_base(IrAnalyze*, IrInstSrc*) (ir.cpp:29793) ==31997== by 0xAEEA4F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30107) ==31997== by 0xB32E17: analyze_fn_ir(CodeGen*, ZigFn*, AstNode*) (analyze.cpp:4830) ==31997== by 0xB333C7: analyze_fn_body(CodeGen*, ZigFn*) (analyze.cpp:4946) ==31997== by 0xB33BC8: semantic_analyze(CodeGen*) (analyze.cpp:5058) ==31997== Address 0x189df0b0 is 16 bytes inside a block of size 64 free'd ==31997== at 0x855F900: free (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834A9: mem::os::free(void*) (mem.hpp:62) ==31997== by 0xA82FD7: heap::CAllocator::internal_deallocate(mem::TypeInfo const&, void*, unsigned long) (heap.cpp:117) ==31997== by 0xAFDA8D: void mem::Allocator::destroy(IrInstSrcDeclRef*) (mem.hpp:127) ==31997== by 0xA84F2E: destroy_instruction_src(IrInstSrc*) (ir.cpp:470) ==31997== by 0xA85DFC: ira_deref(IrAnalyze*) (ir.cpp:753) ==31997== by 0xAEED6F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30170) ==31997== by 0xAB0B49: ir_eval_const_value(CodeGen*, Scope*, AstNode*, ZigValue*, unsigned long*, unsigned long*, ZigFn*, Buf*, AstNode*, Buf*, IrExecutableGen*, AstNode*, UndefAllowed) (ir.cpp:13179) ==31997== by 0xB27E56: analyze_const_value(CodeGen*, Scope*, AstNode*, ZigType*, Buf*, UndefAllowed) (analyze.cpp:1136) ==31997== by 0xB30721: resolve_decl_var(CodeGen*, TldVar*, bool) (analyze.cpp:3987) ==31997== by 0xB3112D: resolve_top_level_decl(CodeGen*, Tld*, AstNode*, bool) (analyze.cpp:4179) ==31997== by 0xACF151: ir_analyze_decl_ref(IrAnalyze*, IrInst*, Tld*) (ir.cpp:21564) ==31997== Block was alloc'd at ==31997== at 0x85609A2: calloc (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834E4: mem::os::calloc(unsigned long, unsigned long) (mem.hpp:72) ==31997== by 0xA82EBF: heap::CAllocator::internal_allocate(mem::TypeInfo const&, unsigned long) (heap.cpp:88) ==31997== by 0xB07282: IrInstSrcDeclRef* mem::Allocator::create() (mem.hpp:122) ==31997== by 0xAFA2C6: IrInstSrcDeclRef* ir_create_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1964) ==31997== by 0xAF3A8E: IrInstSrcDeclRef* ir_build_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1998) ==31997== by 0xA8DB8F: ir_build_decl_ref(IrBuilderSrc*, Scope*, AstNode*, Tld*, LVal) (ir.cpp:4305) ==31997== by 0xA9365A: ir_gen_symbol(IrBuilderSrc*, Scope*, AstNode*, LVal, ResultLoc*) (ir.cpp:5956) ==31997== by 0xAA4C91: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9941) ==31997== by 0xAA56F4: ir_gen_node_extra(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:10085) ==31997== by 0xA93904: ir_gen_field_access(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:6011) ==31997== by 0xAA4DE1: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9962) ==31997== ==31997== Invalid read of size 8 ==31997== at 0xAAF0CA: ir_const(IrAnalyze*, IrInst*, ZigType*) (ir.cpp:12645) ==31997== by 0xAAF236: ir_resolve_cast(IrAnalyze*, IrInst*, IrInstGen*, ZigType*, CastOp) (ir.cpp:12673) ==31997== by 0xAB5BC2: ir_analyze_cast(IrAnalyze*, IrInst*, ZigType*, IrInstGen*) (ir.cpp:14569) ==31997== by 0xAB8311: ir_implicit_cast2(IrAnalyze*, IrInst*, IrInstGen*, ZigType*) (ir.cpp:15182) ==31997== by 0xAC81FA: ir_analyze_fn_call(IrAnalyze*, IrInst*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier, IrInstGen*, IrInst*, bool, IrInstGen**, unsigned long, IrInstGen*, ResultLoc*) (ir.cpp:19720) ==31997== by 0xAC8AE0: ir_analyze_fn_call_src(IrAnalyze*, IrInstSrcCall*, ZigFn*, ZigType*, IrInstGen*, IrInstGen*, IrInst*, CallModifier) (ir.cpp:19844) ==31997== by 0xAC96A5: ir_analyze_instruction_call(IrAnalyze*, IrInstSrcCall*) (ir.cpp:20030) ==31997== by 0xAEDABD: ir_analyze_instruction_base(IrAnalyze*, IrInstSrc*) (ir.cpp:29793) ==31997== by 0xAEEA4F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30107) ==31997== by 0xB32E17: analyze_fn_ir(CodeGen*, ZigFn*, AstNode*) (analyze.cpp:4830) ==31997== by 0xB333C7: analyze_fn_body(CodeGen*, ZigFn*) (analyze.cpp:4946) ==31997== by 0xB33BC8: semantic_analyze(CodeGen*) (analyze.cpp:5058) ==31997== Address 0x189df0a8 is 8 bytes inside a block of size 64 free'd ==31997== at 0x855F900: free (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834A9: mem::os::free(void*) (mem.hpp:62) ==31997== by 0xA82FD7: heap::CAllocator::internal_deallocate(mem::TypeInfo const&, void*, unsigned long) (heap.cpp:117) ==31997== by 0xAFDA8D: void mem::Allocator::destroy(IrInstSrcDeclRef*) (mem.hpp:127) ==31997== by 0xA84F2E: destroy_instruction_src(IrInstSrc*) (ir.cpp:470) ==31997== by 0xA85DFC: ira_deref(IrAnalyze*) (ir.cpp:753) ==31997== by 0xAEED6F: ir_analyze(CodeGen*, IrExecutableSrc*, IrExecutableGen*, ZigType*, AstNode*, ZigValue*) (ir.cpp:30170) ==31997== by 0xAB0B49: ir_eval_const_value(CodeGen*, Scope*, AstNode*, ZigValue*, unsigned long*, unsigned long*, ZigFn*, Buf*, AstNode*, Buf*, IrExecutableGen*, AstNode*, UndefAllowed) (ir.cpp:13179) ==31997== by 0xB27E56: analyze_const_value(CodeGen*, Scope*, AstNode*, ZigType*, Buf*, UndefAllowed) (analyze.cpp:1136) ==31997== by 0xB30721: resolve_decl_var(CodeGen*, TldVar*, bool) (analyze.cpp:3987) ==31997== by 0xB3112D: resolve_top_level_decl(CodeGen*, Tld*, AstNode*, bool) (analyze.cpp:4179) ==31997== by 0xACF151: ir_analyze_decl_ref(IrAnalyze*, IrInst*, Tld*) (ir.cpp:21564) ==31997== Block was alloc'd at ==31997== at 0x85609A2: calloc (in /nix/store/834ixph902bvkyysiixqdgsr37rw5lr2-valgrind-3.15.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==31997== by 0xA834E4: mem::os::calloc(unsigned long, unsigned long) (mem.hpp:72) ==31997== by 0xA82EBF: heap::CAllocator::internal_allocate(mem::TypeInfo const&, unsigned long) (heap.cpp:88) ==31997== by 0xB07282: IrInstSrcDeclRef* mem::Allocator::create() (mem.hpp:122) ==31997== by 0xAFA2C6: IrInstSrcDeclRef* ir_create_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1964) ==31997== by 0xAF3A8E: IrInstSrcDeclRef* ir_build_instruction(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:1998) ==31997== by 0xA8DB8F: ir_build_decl_ref(IrBuilderSrc*, Scope*, AstNode*, Tld*, LVal) (ir.cpp:4305) ==31997== by 0xA9365A: ir_gen_symbol(IrBuilderSrc*, Scope*, AstNode*, LVal, ResultLoc*) (ir.cpp:5956) ==31997== by 0xAA4C91: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9941) ==31997== by 0xAA56F4: ir_gen_node_extra(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:10085) ==31997== by 0xA93904: ir_gen_field_access(IrBuilderSrc*, Scope*, AstNode*) (ir.cpp:6011) ==31997== by 0xAA4DE1: ir_gen_node_raw(IrBuilderSrc*, AstNode*, Scope*, LVal, ResultLoc*) (ir.cpp:9962) ==31997== LLVM Emit Output...==31997== Conditional jump or move depends on uninitialised value(s) ==31997== at 0x4847D81: llvm::DwarfCompileUnit::addRange(llvm::RangeSpan) (in /home/andy/dev/zig/build/zig) ==31997== by 0x47F7697: llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (in /home/andy/dev/zig/build/zig) ==31997== by 0x47CFC49: llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (in /home/andy/dev/zig/build/zig) ==31997== by 0x47CA7FE: llvm::AsmPrinter::EmitFunctionBody() (in /home/andy/dev/zig/build/zig) ==31997== by 0x33BE2DE: llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (in /home/andy/dev/zig/build/zig) ==31997== by 0x49DEFF3: llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (in /home/andy/dev/zig/build/zig) ==31997== by 0x565CAB7: llvm::FPPassManager::runOnFunction(llvm::Function&) (in /home/andy/dev/zig/build/zig) ==31997== by 0x565E010: llvm::FPPassManager::runOnModule(llvm::Module&) (in /home/andy/dev/zig/build/zig) ==31997== by 0x565E3B7: llvm::legacy::PassManagerImpl::run(llvm::Module&) (in /home/andy/dev/zig/build/zig) ==31997== by 0xE36CC3: ZigLLVMTargetMachineEmitToFile (zig_llvm.cpp:268) ==31997== by 0xA6B181: zig_llvm_emit_output(CodeGen*) (codegen.cpp:8029) ==31997== by 0xA7596D: codegen_build_and_link(CodeGen*) (codegen.cpp:10759) ==31997== All 903 tests passed. ==31997== ==31997== HEAP SUMMARY: ==31997== in use at exit: 523,412,667 bytes in 6,002,901 blocks ==31997== total heap usage: 12,573,315 allocs, 6,570,414 frees, 2,323,942,786 bytes allocated ==31997== ==31997== LEAK SUMMARY: ==31997== definitely lost: 86,514,391 bytes in 1,375,938 blocks ==31997== indirectly lost: 70,893,634 bytes in 1,038,011 blocks ==31997== possibly lost: 86,439,416 bytes in 442,755 blocks ==31997== still reachable: 279,565,226 bytes in 3,146,197 blocks ==31997== of which reachable via heuristic: ==31997== stdstring : 640 bytes in 4 blocks ==31997== newarray : 64,184 bytes in 1,196 blocks ==31997== suppressed: 0 bytes in 0 blocks ==31997== Rerun with --leak-check=full to see details of leaked memory ==31997== ==31997== Use --track-origins=yes to see where uninitialised values come from ==31997== For lists of detected and suppressed errors, rerun with: -s ==31997== ERROR SUMMARY: 6 errors from 4 contexts (suppressed: 0 from 0)