zig icon indicating copy to clipboard operation
zig copied to clipboard

building stage3 with --verbose-air crashes

Open pjz opened this issue 1 year ago • 1 comments

Zig Version

0.10.0-dev.3384+ae8394af5

Steps to Reproduce

The gist is: ./stage2/bin/zig build -p stage3 -Denable-llvm -Dconfig_h=build/config.h --verbose-link --verbose-air

More exactly, on my ubuntu 22.04 system I checked out the zig source, put the Makefile at https://clbin.com/yGJYv into the root of it, and did make stage4

Expected Behavior

I expected it to dump the AIR as it compiled.

Actual Behavior

Full log at https://clbin.com/de5sT

What I think are the useful bits:

       %28805 = break(%28461, %28467)                                         
      })                                                                       
    For full context, use the command                                          
      zig ast-check -t /home/pj/src/zig/src/main.zig                                                                                                                                           
                                                                                                                                                                                               
  in /home/pj/src/zig/src/main.zig: main.zig:buildOutputType                                                                                                                                   
    > %28461 = block({%28042..%28460})                                                                                                                                                         
                                                                                                                                                                                               
/home/pj/src/zig/build/stage1/lib/zig/std/debug.zig:281:14: 0x2e52978 in std.debug.assert (zig)                                                                                                
    if (!ok) unreachable; // assertion failure                                                                                                                                                 
             ^                                                                                                                                                                                 
/home/pj/src/zig/src/type.zig:5529:23: 0x3855d37 in type.Type.structFieldValueComptime (zig)                                                                                                   
                assert(struct_obj.layout != .Packed);                                                                                                                                          
                      ^                                                                                                                                                                        
/home/pj/src/zig/src/TypedValue.zig:158:59: 0x40bc6ec in TypedValue.print (zig)                                                                                                                
                        .val = ty.structFieldValueComptime(i) orelse b: {                                                                                                                      
                                                          ^                                                                                                                                    
/home/pj/src/zig/src/TypedValue.zig:63:24: 0x3fd2592 in TypedValue.format (zig)             
    return ctx.tv.print(writer, 3, ctx.mod);                                   
                       ^                                                                                                 
/home/pj/src/zig/build/stage1/lib/zig/std/fmt.zig:1706:26: 0x3e1c693 in std.fmt.Formatter(TypedValue.format).format (zig)
            try format_fn(self.data, fmt, options, writer);                            
                         ^                                                     
/home/pj/src/zig/build/stage1/lib/zig/std/fmt.zig:481:32: 0x3e1c5c7 in std.fmt.formatType (zig)
        return try value.format(actual_fmt, options, writer);                                                            
                               ^                                                        
/home/pj/src/zig/build/stage1/lib/zig/std/fmt.zig:183:23: 0x3c31dc5 in std.fmt.format (zig)                              
        try formatType(                                                                        
                      ^                                                                               
/home/pj/src/zig/build/stage1/lib/zig/std/io/writer.zig:28:34: 0x3a57869 in std.io.writer.Writer(std.fs.file.File,std.os.WriteError,std.fs.file.File.write).print (zig)            return std.fmt.format(self, format, args);                 
                                 ^                                             
/home/pj/src/zig/src/print_air.zig:554:20: 0x38a21aa in print_air.Writer.writeConstant (zig)
        try s.print(", {}", .{val.fmtValue(ty, w.module)});                    
                   ^                                                           
/home/pj/src/zig/src/print_air.zig:274:45: 0x367c0cb in print_air.Writer.writeInst (zig)
            .constant => try w.writeConstant(s, inst),                         
                                            ^                                  
/home/pj/src/zig/src/print_air.zig:77:36: 0x3438f99 in print_air.Writer.writeAllConstants (zig)
                    try w.writeInst(s, inst);                                  
                                   ^                                           
/home/pj/src/zig/src/print_air.zig:57:29: 0x3253d11 in print_air.dump (zig)    
    writer.writeAllConstants(stream) catch return;                             
                            ^                                                  
/home/pj/src/zig/src/Module.zig:4175:46: 0x3234224 in Module.ensureFuncBodyAnalyzed (zig)
                @import("print_air.zig").dump(mod, air, liveness);             
                                             ^                                 
/home/pj/src/zig/src/Sema.zig:24475:36: 0x38fbbc3 in Sema.ensureFuncBodyAnalyzed (zig)
    sema.mod.ensureFuncBodyAnalyzed(func) catch |err| {                        
                                   ^                                           
/home/pj/src/zig/src/Sema.zig:26321:40: 0x383c0c0 in Sema.resolveInferredErrorSet (zig)
        try sema.ensureFuncBodyAnalyzed(ies.func);                             
                                       ^                                       
/home/pj/src/zig/src/Sema.zig:24715:49: 0x3664982 in Sema.analyzeIsNonErrComptimeOnly (zig)
                try sema.resolveInferredErrorSet(block, src, ies);             
                                                ^                              
/home/pj/src/zig/src/Sema.zig:24742:56: 0x383ba05 in Sema.analyzeIsNonErr (zig)
    const result = try sema.analyzeIsNonErrComptimeOnly(block, src, operand);  
                                                       ^                       
/home/pj/src/zig/src/Sema.zig:14286:32: 0x35e9124 in Sema.zirIsNonErr (zig)    
    return sema.analyzeIsNonErr(block, inst_data.src(), operand);              
                               ^                                               
/home/pj/src/zig/src/Sema.zig:762:66: 0x344563a in Sema.analyzeBodyInner (zig) 
            .is_non_err                   => try sema.zirIsNonErr(block, inst),
                                                                 ^             
/home/pj/src/zig/src/Sema.zig:4843:34: 0x384ef2a in Sema.resolveBlockBody (zig)
        if (sema.analyzeBodyInner(child_block, body)) |_| {                    
                                 ^                                             
/home/pj/src/zig/src/Sema.zig:4826:33: 0x36617ec in Sema.zirBlock (zig)        
    return sema.resolveBlockBody(parent_block, src, &child_block, body, inst, &label.merges);
                                ^                                              
/home/pj/src/zig/src/Sema.zig:1231:69: 0x345060b in Sema.analyzeBodyInner (zig)
                if (!block.is_comptime) break :blk try sema.zirBlock(block, inst);
                                                                    ^          
/home/pj/src/zig/src/Sema.zig:602:30: 0x3436e9a in Sema.analyzeBody (zig)      
    _ = sema.analyzeBodyInner(block, body) catch |err| switch (err) {          
                             ^                                                 
/home/pj/src/zig/src/Module.zig:5423:21: 0x325139d in Module.analyzeFnBody (zig)
    sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {    
                    ^                                                          
/home/pj/src/zig/src/Compilation.zig:2962:42: 0x2f6294a in Compilation.processOneJob (zig)
            module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {     
                                         ^                                     
/home/pj/src/zig/src/Compilation.zig:2894:30: 0x2f4c50d in Compilation.performAllTheWork (zig)
            try processOneJob(comp, work_item);                                
                             ^                                                 
/home/pj/src/zig/src/Compilation.zig:2234:31: 0x2f44a03 in Compilation.update (zig)
    try comp.performAllTheWork(main_progress_node);                            
                              ^                                                
/home/pj/src/zig/src/main.zig:3326:20: 0x2eafb1f in updateModule (zig)         
    try comp.update();                                                         
                   ^                                                           
/home/pj/src/zig/src/main.zig:3015:17: 0x2e78311 in buildOutputType (zig)      
    updateModule(gpa, comp, hook) catch |err| switch (err) {                   
                ^                                                              
/home/pj/src/zig/src/main.zig:230:31: 0x2e5bed7 in mainArgs (zig)              
        return buildOutputType(gpa, arena, args, .{ .build = .Exe });          
                              ^                                                
/home/pj/src/zig/src/main.zig:174:20: 0x2e5b1a4 in main (zig)                  
    return mainArgs(gpa, arena, args);                                         
                   ^                                                           
/home/pj/src/zig/build/stage1/lib/zig/std/start.zig:576:37: 0x2e5dacf in std.start.main (zig)
            const result = root.main() catch |err| {                           
                                    ^                                          
???:?:?: 0x7f22332b6236 in ??? (???)                                           
???:?:?: 0x7ffc88910bd2 in ??? (???)                                           
error: zig...                                                                  
error: The following command terminated unexpectedly:
/home/pj/src/zig/stage2/bin/zig build-exe --stack 33554432 /home/pj/src/zig/src/main.zig -lc /home/pj/src/zig/build/zigcpp/libzigcpp.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangFrontendTool.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangCodeGen.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangFrontend.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangDriver.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangSerialization.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangSema.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangStaticAnalyzerFrontend.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangStaticAnalyzerCheckers.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangStaticAnalyzerCore.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangAnalysis.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangASTMatchers.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangAST.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangParse.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangSema.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangBasic.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangEdit.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangLex.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangARCMigrate.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangRewriteFrontend.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangRewrite.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangCrossTU.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangIndex.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/libclangToolingCore.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldMinGW.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldELF.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldCOFF.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldWasm.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldMachO.a /home/pj/src/zig/Downloads/llvm-project-14/local/lib/liblldCommon.a -lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver -lLLVMCoverage -lLLVMLineEditor -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyUtils -lLLVMWebAssemblyInfo -lLLVMVEDisassembler -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler -lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser -lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser -lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils -lLLVMARMInfo -lLLVMAMDGPUTargetMCA -lLLVMAMDGPUDisassembler -lLLVMAMDGPUAsmParser -lLLVMAMDGPUCodeGen -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler -lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils -lLLVMAArch64Info -lLLVMOrcJIT -lLLVMMCJIT -lLLVMJITLink -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMDWP -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoGSYM -lLLVMOption -lLLVMObjectYAML -lLLVMMCA -lLLVMMCDisassembler -lLLVMLTO -lLLVMPasses -lLLVMCFGuard -lLLVMCoroutines -lLLVMObjCARCOpts -lLLVMipo -lLLVMVectorize -lLLVMLinker -lLLVMInstrumentation -lLLVMFrontendOpenMP -lLLVMFrontendOpenACC -lLLVMExtensions -lLLVMDWARFLinker -lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMDebugInfoMSF -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMIRReader -lLLVMAsmParser -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMFuzzMutate -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMTableGen -lLLVMSupport -lLLVMDemangle -lz /nix/store/kiwdwd6zw4svi9jlr95yg1p5pgpjxn1v-gcc-11.3.0/lib64/libstdc++.a -lunwind --verbose-air --verbose-link --cache-dir /home/pj/src/zig/zig-cache --global-cache-dir /home/pj/.cache/zig --name zig --pkg-begin build_options /home/pj/src/zig/zig-cache/options/0V30lZxrCGxoJJu_wgq4pjWG5LbJCCWtOh-1ZET6CythtTEzpveIM63_yrSxmYWR --pkg-end -I /home/pj/src/zig/Downloads/llvm-project-14/local/include -L /home/pj/src/zig/Downloads/llvm-project-14/local/lib -isystem /home/pj/src/zig/Downloads/llvm-project-14/local/include -fno-build-id --enable-cache 
error: the following build command failed with exit code 6:                    
/home/pj/src/zig/zig-cache/o/030ed0fa1b247ad7a49342798f9109e0/build /home/pj/src/zig/stage2/bin/zig /home/pj/src/zig /home/pj/src/zig/zig-cache /home/pj/.cache/zig -p stage3 -Denable-llvm -Dconfig_h=build/config.h --verbose-link --verbose-air

pjz avatar Jul 30 '22 03:07 pjz

Still repros for me as of 3cf8f283d3f271b6d0b5de39f55e4ea40b83eece .

pjz avatar Jul 31 '22 01:07 pjz

3cf8f28 is prior to c0a1b4fa46dfd00d0cc4d1b6954bc07ae762e31e, where this is fixed - Have you tried with c0a1b4fa46dfd00d0cc4d1b6954bc07ae762e31e?

topolarity avatar Jul 31 '22 23:07 topolarity

Looks like that took care of it!

pjz avatar Aug 01 '22 02:08 pjz