| author | |
| committer | |
| log | 32997a2fb06edd4365116d07d88de742b59df84d |
| tree | 73ea5e889469bc861bd8e632e1872e9ea9236e27 |
| parent | a1d0c77539336019f6011e4e98ace3302da5765e |
stage1: allow idx 0 err to be put into error_name_table4 files changed, 22 insertions(+), 6 deletions(-)
src/stage1/codegen.cpp+2-6| ... | ... | @@ -5184,11 +5184,7 @@ static LLVMValueRef ir_render_ref(CodeGen *g, IrExecutableGen *executable, IrIns |
| 5184 | 5184 | |
| 5185 | 5185 | static LLVMValueRef ir_render_err_name(CodeGen *g, IrExecutableGen *executable, IrInstGenErrName *instruction) { |
| 5186 | 5186 | assert(g->generate_error_name_table); |
| 5187 | ||
| 5188 | if (g->errors_by_index.length == 1) { | |
| 5189 | LLVMBuildUnreachable(g->builder); | |
| 5190 | return nullptr; | |
| 5191 | } | |
| 5187 | assert(g->errors_by_index.length > 0); | |
| 5192 | 5188 | |
| 5193 | 5189 | LLVMValueRef err_val = ir_llvm_value(g, instruction->value); |
| 5194 | 5190 | if (ir_want_runtime_safety(g, &instruction->base)) { |
| ... | ... | @@ -7870,7 +7866,7 @@ static void render_const_val_global(CodeGen *g, ZigValue *const_val, const char |
| 7870 | 7866 | } |
| 7871 | 7867 | |
| 7872 | 7868 | static void generate_error_name_table(CodeGen *g) { |
| 7873 | if (g->err_name_table != nullptr || !g->generate_error_name_table || g->errors_by_index.length == 1) { | |
| 7869 | if (g->err_name_table != nullptr || !g->generate_error_name_table) { | |
| 7874 | 7870 | return; |
| 7875 | 7871 | } |
| 7876 | 7872 |
test/standalone.zig+1| ... | ... | @@ -19,6 +19,7 @@ pub fn addCases(cases: *tests.StandaloneContext) void { |
| 19 | 19 | cases.addBuildFile("test/standalone/use_alias/build.zig"); |
| 20 | 20 | cases.addBuildFile("test/standalone/brace_expansion/build.zig"); |
| 21 | 21 | cases.addBuildFile("test/standalone/empty_env/build.zig"); |
| 22 | cases.addBuildFile("test/standalone/issue_7030/build.zig"); | |
| 22 | 23 | if (std.Target.current.os.tag != .wasi) { |
| 23 | 24 | cases.addBuildFile("test/standalone/load_dynamic_library/build.zig"); |
| 24 | 25 | } |
test/standalone/issue_7030/build.zig created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | const Builder = @import("std").build.Builder; | |
| 2 | ||
| 3 | pub fn build(b: *Builder) void { | |
| 4 | const exe = b.addExecutable("issue_7030", "main.zig"); | |
| 5 | exe.setTarget(.{ | |
| 6 | .cpu_arch = .wasm32, | |
| 7 | .os_tag = .freestanding, | |
| 8 | }); | |
| 9 | exe.install(); | |
| 10 | b.default_step.dependOn(&exe.step); | |
| 11 | ||
| 12 | const test_step = b.step("test", "Test the program"); | |
| 13 | test_step.dependOn(&exe.step); | |
| 14 | } |
test/standalone/issue_7030/main.zig created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn main() anyerror!void { | |
| 4 | std.log.info("All your codebase are belong to us.", .{}); | |
| 5 | } |