zig

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

commit d415ffd7d95f9c88210154c19e64dabd6b546809 (tree)
parent 6c907a350989aa881cc0b0f71ec81d1ae1b449b7
Author: xackus <14938807+xackus@users.noreply.github.com>
Date:   Sun, 19 Apr 2020 05:23:14 +0200

fix uninitialized ZigValue

Diffstat:
Msrc/all_types.hpp | 5+++--
Msrc/ir.cpp | 2+-
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/all_types.hpp b/src/all_types.hpp @@ -524,10 +524,11 @@ struct ZigValue { RuntimeHintSlice rh_slice; } data; - // uncomment these to find bugs. can't leave them uncommented because of a gcc-9 warning - //ZigValue(const ZigValue &other) = delete; // plz zero initialize with {} + // uncomment this to find bugs. can't leave it uncommented because of a gcc-9 warning //ZigValue& operator= (const ZigValue &other) = delete; // use copy_const_val + ZigValue(const ZigValue &other) = delete; // plz zero initialize with ZigValue val = {}; + // for use in debuggers void dump(); }; diff --git a/src/ir.cpp b/src/ir.cpp @@ -17009,7 +17009,7 @@ static IrInstGen *ir_analyze_bit_shift(IrAnalyze *ira, IrInstSrcBinOp *bin_op_in if (op2_val == nullptr) return ira->codegen->invalid_inst_gen; - ZigValue bit_count_value; + ZigValue bit_count_value = {}; init_const_usize(ira->codegen, &bit_count_value, bit_count); if (!value_cmp_numeric_val_all(op2_val, CmpLT, &bit_count_value)) {