| author | |
| committer | |
| log | b6b7a6401c064582b610b8ca6935a388c3bb3c03 |
| tree | 90f175d522cadf89bb6a1c42c7fecc1049c12d89 |
| parent | 58241364cb09debd0effd9f7fb1d1a7eeaaae7c7 |
| parent | e3db2be89943333362210c1a8eb62b81c47bc1d2 |
| signature |
stage1: allow idx 0 err to be put into error_name_table4 files changed, 22 insertions(+), 6 deletions(-)
src/stage1/codegen.cpp+2-6| ... | ... | @@ -5178,11 +5178,7 @@ static LLVMValueRef ir_render_ref(CodeGen *g, IrExecutableGen *executable, IrIns |
| 5178 | 5178 | |
| 5179 | 5179 | static LLVMValueRef ir_render_err_name(CodeGen *g, IrExecutableGen *executable, IrInstGenErrName *instruction) { |
| 5180 | 5180 | assert(g->generate_error_name_table); |
| 5181 | ||
| 5182 | if (g->errors_by_index.length == 1) { | |
| 5183 | LLVMBuildUnreachable(g->builder); | |
| 5184 | return nullptr; | |
| 5185 | } | |
| 5181 | assert(g->errors_by_index.length > 0); | |
| 5186 | 5182 | |
| 5187 | 5183 | LLVMValueRef err_val = ir_llvm_value(g, instruction->value); |
| 5188 | 5184 | if (ir_want_runtime_safety(g, &instruction->base)) { |
| ... | ... | @@ -7890,7 +7886,7 @@ static void render_const_val_global(CodeGen *g, ZigValue *const_val, const char |
| 7890 | 7886 | } |
| 7891 | 7887 | |
| 7892 | 7888 | static void generate_error_name_table(CodeGen *g) { |
| 7893 | if (g->err_name_table != nullptr || !g->generate_error_name_table || g->errors_by_index.length == 1) { | |
| 7889 | if (g->err_name_table != nullptr || !g->generate_error_name_table) { | |
| 7894 | 7890 | return; |
| 7895 | 7891 | } |
| 7896 | 7892 |
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 | } |