Commit d415ffd7d9

xackus <14938807+xackus@users.noreply.github.com>
2020-04-19 05:23:14
fix uninitialized ZigValue
1 parent 6c907a3
Changed files (2)
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();
 };
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)) {