authorgravatar for 14938807+xackus@users.noreply.github.comxackus <14938807+xackus@users.noreply.github.com> 2020-04-19 05:23:14+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-19 03:49:36-04:00
logd415ffd7d95f9c88210154c19e64dabd6b546809
tree68202442782bfdf3d33b99329a534000ad6bfcf3
parent6c907a350989aa881cc0b0f71ec81d1ae1b449b7

fix uninitialized ZigValue


2 files changed, 4 insertions(+), 3 deletions(-)

src/all_types.hpp+3-2
...@@ -524,10 +524,11 @@ struct ZigValue {...@@ -524,10 +524,11 @@ struct ZigValue {
524 RuntimeHintSlice rh_slice;524 RuntimeHintSlice rh_slice;
525 } data;525 } data;
526526
527 // uncomment these to find bugs. can't leave them uncommented because of a gcc-9 warning527 // uncomment this to find bugs. can't leave it uncommented because of a gcc-9 warning
528 //ZigValue(const ZigValue &other) = delete; // plz zero initialize with {}
529 //ZigValue& operator= (const ZigValue &other) = delete; // use copy_const_val528 //ZigValue& operator= (const ZigValue &other) = delete; // use copy_const_val
530529
530 ZigValue(const ZigValue &other) = delete; // plz zero initialize with ZigValue val = {};
531
531 // for use in debuggers532 // for use in debuggers
532 void dump();533 void dump();
533};534};
src/ir.cpp+1-1
...@@ -17009,7 +17009,7 @@ static IrInstGen *ir_analyze_bit_shift(IrAnalyze *ira, IrInstSrcBinOp *bin_op_in...@@ -17009,7 +17009,7 @@ static IrInstGen *ir_analyze_bit_shift(IrAnalyze *ira, IrInstSrcBinOp *bin_op_in
17009 if (op2_val == nullptr)17009 if (op2_val == nullptr)
17010 return ira->codegen->invalid_inst_gen;17010 return ira->codegen->invalid_inst_gen;
1701117011
17012 ZigValue bit_count_value;17012 ZigValue bit_count_value = {};
17013 init_const_usize(ira->codegen, &bit_count_value, bit_count);17013 init_const_usize(ira->codegen, &bit_count_value, bit_count);
1701417014
17015 if (!value_cmp_numeric_val_all(op2_val, CmpLT, &bit_count_value)) {17015 if (!value_cmp_numeric_val_all(op2_val, CmpLT, &bit_count_value)) {