From 76028e8855c9f8d0e14d74e3b1e599face3b54fa Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 5 Sep 2022 22:43:27 +0300 Subject: [PATCH] Fix compilation warnings --- ir.g | 5 +++-- ir.h | 2 +- ir_check.c | 3 ++- ir_gcm.c | 3 ++- ir_ra.c | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ir.g b/ir.g index 67bd4bb..00bbeba 100644 --- a/ir.g +++ b/ir.g @@ -125,7 +125,7 @@ ir_func_prototype(ir_parser_ctx *p): ir_insn(ir_parser_ctx *p): {const char *str, *str2 = NULL, *func;} - {size_t len, len2, func_len;} + {size_t len, len2 = 0, func_len;} {uint8_t op;} {uint8_t t = 0;} {ir_ref op1 = IR_UNUSED;} @@ -147,7 +147,8 @@ ir_insn(ir_parser_ctx *p): ID(&str, &len) ) "=" - ( const(t, &val) + ( {val.u64 = 0;} + const(t, &val) {ref = ir_const(p->ctx, val, t);} | "func" "(" ID(&func, &func_len) {flags.u64 = 0;} diff --git a/ir.h b/ir.h index fcc1c4a..01bbcd1 100644 --- a/ir.h +++ b/ir.h @@ -588,7 +588,7 @@ void ir_dump_live_ranges(ir_ctx *ctx, FILE *f); int ir_emit_c(ir_ctx *ctx, FILE *f); /* IR verification API (implementation in ir_check.c) */ -void ir_check(ir_ctx *ctx); +bool ir_check(ir_ctx *ctx); void ir_consistency_check(void); /* IR Memmory Allocation */ diff --git a/ir_check.c b/ir_check.c index 650b3ef..61c3ae1 100644 --- a/ir_check.c +++ b/ir_check.c @@ -33,7 +33,7 @@ void ir_consistency_check(void) IR_ASSERT(IR_ADD + 1 == IR_SUB); } -void ir_check(ir_ctx *ctx) +bool ir_check(ir_ctx *ctx) { //TODO: ir_ref i, j, n, *p, use; @@ -179,4 +179,5 @@ void ir_check(ir_ctx *ctx) } IR_ASSERT(ok); + return ok; } diff --git a/ir_gcm.c b/ir_gcm.c index 498d441..9ce7627 100644 --- a/ir_gcm.c +++ b/ir_gcm.c @@ -548,6 +548,7 @@ restart: } new_insn->op3 = ref; if (n > 3) { + ir_ref *ops = new_insn->ops; for (k = 3, p = insn->ops + 3; k <= n; k++, p++) { ref = *p; ref = _xlat[ref]; @@ -556,7 +557,7 @@ restart: lists[ref].count++; edges_count++; } - new_insn->ops[k] = ref; + ops[k] = ref; } } break; diff --git a/ir_ra.c b/ir_ra.c index 8b220d6..912ba92 100644 --- a/ir_ra.c +++ b/ir_ra.c @@ -1273,6 +1273,7 @@ IR_ALWAYS_INLINE ir_live_pos ir_ival_end(ir_live_interval *ival) #endif } +#ifdef IR_DEBUG static bool ir_ival_covers(ir_live_interval *ival, ir_live_pos position) { ir_live_range *live_range = &ival->range; @@ -1286,6 +1287,7 @@ static bool ir_ival_covers(ir_live_interval *ival, ir_live_pos position) return 0; } +#endif static bool ir_ival_has_hole_between(ir_live_interval *ival, ir_live_pos from, ir_live_pos to) {