zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 278c7a2bc398ac71afc9b9b392e863a758abb5fd (tree)
parent ce5d50e4ed519d23d7a467bdfee196093a3f5dc2
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 12 Jun 2019 13:42:21 -0400

fix `@bitCast` regressions

Diffstat:
Msrc/ir.cpp | 3++-
Mstd/special/bootstrap.zig | 26+++++++++++++-------------
2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/ir.cpp b/src/ir.cpp @@ -4951,6 +4951,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo ResultLocBitCast *result_loc_bit_cast = allocate<ResultLocBitCast>(1); result_loc_bit_cast->base.id = ResultLocIdBitCast; result_loc_bit_cast->base.source_instruction = dest_type; + ir_ref_instruction(dest_type, irb->current_basic_block); result_loc_bit_cast->parent = result_loc; AstNode *arg1_node = node->data.fn_call_expr.params.at(1); @@ -24219,7 +24220,7 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInstructionBitCastSrc *instruction) { IrInstruction *operand = instruction->operand->child; - if (type_is_invalid(operand->value.type) || instr_is_comptime(operand) || + if (type_is_invalid(operand->value.type) || instruction->result_loc_bit_cast->parent->gen_instruction == nullptr) { return operand; diff --git a/std/special/bootstrap.zig b/std/special/bootstrap.zig @@ -78,19 +78,19 @@ fn posixCallMainAndExit() noreturn { while (envp_optional[envp_count]) |_| : (envp_count += 1) {} const envp = @ptrCast([*][*]u8, envp_optional)[0..envp_count]; - if (builtin.os == .linux) { - // Find the beginning of the auxiliary vector - const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1); - std.os.linux.elf_aux_maybe = auxv; - // Initialize the TLS area - std.os.linux.tls.initTLS(); - - if (std.os.linux.tls.tls_image) |tls_img| { - const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size); - const tp = std.os.linux.tls.copyTLS(tls_addr); - std.os.linux.tls.setThreadPointer(tp); - } - } + //if (builtin.os == .linux) { + // // Find the beginning of the auxiliary vector + // const auxv = @ptrCast([*]std.elf.Auxv, envp.ptr + envp_count + 1); + // std.os.linux.elf_aux_maybe = auxv; + // // Initialize the TLS area + // std.os.linux.tls.initTLS(); + + // if (std.os.linux.tls.tls_image) |tls_img| { + // const tls_addr = std.os.linux.tls.allocateTLS(tls_img.alloc_size); + // const tp = std.os.linux.tls.copyTLS(tls_addr); + // std.os.linux.tls.setThreadPointer(tp); + // } + //} std.os.exit(callMainWithArgs(argc, argv, envp)); }