mirror of
https://github.com/ziglang/zig.git
synced 2026-01-11 18:05:11 +00:00
fix regressions in get_elem_ptr related to undefined
This commit is contained in:
parent
d0b055d69e
commit
fb8da16a60
@ -17918,6 +17918,9 @@ static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
|
||||
var = var->next_var;
|
||||
}
|
||||
|
||||
if (var->var_type == nullptr || type_is_invalid(var->var_type))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
||||
bool is_volatile = false;
|
||||
ZigType *var_ptr_type = get_pointer_to_type_extra(ira->codegen, var->var_type,
|
||||
var->src_is_const, is_volatile, PtrLenSingle, var->align_bytes, 0, 0, false);
|
||||
@ -17926,9 +17929,6 @@ static IrInstruction *ir_get_var_ptr(IrAnalyze *ira, IrInstruction *instruction,
|
||||
return ir_implicit_cast(ira, var->ptr_instruction, var_ptr_type);
|
||||
}
|
||||
|
||||
if (var->var_type == nullptr || type_is_invalid(var->var_type))
|
||||
return ira->codegen->invalid_instruction;
|
||||
|
||||
ZigValue *mem_slot = nullptr;
|
||||
|
||||
bool comptime_var_mem = ir_get_var_is_comptime(var);
|
||||
@ -19761,7 +19761,7 @@ static IrInstruction *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstruct
|
||||
array_ptr_val->data.x_ptr.special != ConstPtrSpecialHardCodedAddr))
|
||||
{
|
||||
if ((err = ir_resolve_const_val(ira->codegen, ira->new_irb.exec,
|
||||
elem_ptr_instruction->base.source_node, array_ptr_val, UndefBad)))
|
||||
elem_ptr_instruction->base.source_node, array_ptr_val, UndefOk)))
|
||||
{
|
||||
return ira->codegen->invalid_instruction;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ comptime {
|
||||
_ = @import("behavior/fn.zig");
|
||||
_ = @import("behavior/fn_in_struct_in_comptime.zig");
|
||||
_ = @import("behavior/fn_delegation.zig");
|
||||
//_ = @import("behavior/for.zig");
|
||||
_ = @import("behavior/for.zig");
|
||||
_ = @import("behavior/generics.zig");
|
||||
_ = @import("behavior/hasdecl.zig");
|
||||
_ = @import("behavior/hasfield.zig");
|
||||
@ -107,7 +107,7 @@ comptime {
|
||||
_ = @import("behavior/type.zig");
|
||||
_ = @import("behavior/type_info.zig");
|
||||
_ = @import("behavior/typename.zig");
|
||||
//_ = @import("behavior/undefined.zig");
|
||||
_ = @import("behavior/undefined.zig");
|
||||
_ = @import("behavior/underscore.zig");
|
||||
_ = @import("behavior/union.zig");
|
||||
_ = @import("behavior/usingnamespace.zig");
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
const expect = @import("std").testing.expect;
|
||||
const mem = @import("std").mem;
|
||||
const std = @import("std");
|
||||
const expect = std.testing.expect;
|
||||
const mem = std.mem;
|
||||
|
||||
fn initStaticArray() [10]i32 {
|
||||
var array: [10]i32 = undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user