diff options
| author | LemonBoy <thatlemon@gmail.com> | 2019-02-20 00:20:04 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-13 11:35:05 -0400 |
| commit | 49838a9f3eee0df33d2994b92875314363b32dfc (patch) | |
| tree | 9d88deed4d89a5b528d8f6500910ca98d322566b /src/ir.cpp | |
| parent | 1ed38a682ec6cabcd72472b6988b27b10714216a (diff) | |
| download | zig-49838a9f3eee0df33d2994b92875314363b32dfc.tar.gz zig-49838a9f3eee0df33d2994b92875314363b32dfc.zip | |
Fix generation of comptime slices
By erasing the global_refs field we'd trip any codepath using
const_values_equal_ptr to figure if two slices were different.
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index e7b1f2f40e..26bc375003 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -17329,7 +17329,9 @@ static IrInstruction *ir_analyze_instruction_container_init_list(IrAnalyze *ira, if (const_val.special == ConstValSpecialStatic) { IrInstruction *result = ir_const(ira, &instruction->base, nullptr); ConstExprValue *out_val = &result->value; - copy_const_val(out_val, &const_val, true); + // Make sure to pass same_global_refs=false here in order not to + // zero the global_refs field for `result` (#1608) + copy_const_val(out_val, &const_val, false); result->value.type = fixed_size_array_type; for (size_t i = 0; i < elem_count; i += 1) { ConstExprValue *elem_val = &out_val->data.x_array.data.s_none.elements[i]; |
