| author | |
| committer | |
| log | de2b0cd722ca8fe98d16c86825db4cb2a70931c6 |
| tree | 04124d8ac7ac014635c3fa97bee3e765bc81cfe0 |
| parent | 24400d5882aa2b83a4aed3e4c1503d0393e1c541 |
errors as reported on macOS w/ Xcode 10.1, 10.2 and 11.0:
src/ir.cpp:23285:16: error: variable 'bits' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
} else if (float_type->id == ZigTypeIdFloat)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23288:13: note: uninitialized use occurs here
switch (bits) {
^~~~
src/ir.cpp:23285:12: note: remove the 'if' if its condition is always true
} else if (float_type->id == ZigTypeIdFloat)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ir.cpp:23281:18: note: initialize the variable 'bits' to silence this warning
unsigned bits;1 files changed, 8 insertions(+), 2 deletions(-)
src/ir.cpp+8-2| ... | @@ -23280,10 +23280,16 @@ static void ir_eval_float_op(IrAnalyze *ira, IrInstructionFloatOp *source_instr, | ... | @@ -23280,10 +23280,16 @@ static void ir_eval_float_op(IrAnalyze *ira, IrInstructionFloatOp *source_instr, |
| 23280 | BuiltinFnId fop = source_instr->op; | 23280 | BuiltinFnId fop = source_instr->op; |
| 23281 | unsigned bits; | 23281 | unsigned bits; |
| 23282 | 23282 | ||
| 23283 | if (float_type->id == ZigTypeIdComptimeFloat) { | 23283 | switch (float_type->id) { |
| 23284 | case ZigTypeIdComptimeFloat: | ||
| 23284 | bits = 128; | 23285 | bits = 128; |
| 23285 | } else if (float_type->id == ZigTypeIdFloat) | 23286 | break; |
| 23287 | case ZigTypeIdFloat: | ||
| 23286 | bits = float_type->data.floating.bit_count; | 23288 | bits = float_type->data.floating.bit_count; |
| 23289 | break; | ||
| 23290 | default: | ||
| 23291 | zig_unreachable(); | ||
| 23292 | } | ||
| 23287 | 23293 | ||
| 23288 | switch (bits) { | 23294 | switch (bits) { |
| 23289 | case 16: { | 23295 | case 16: { |