From 2cf9715c9a766234ccf8a514bdf23af72c90b507 Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Thu, 20 Feb 2014 20:06:42 +1100 Subject: [PATCH] utils/romcc.c: Fix spurious unsigned integer comparisons. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clang warns about comparisons of unsigned integers with being below zero. Remove spurious logic checks that are always false. Change-Id: I70c4d5331df81e48bf7ef27ff98400c4218f7edc Signed-off-by: Edward O'Callaghan Reviewed-on: http://review.coreboot.org/5275 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- util/romcc/romcc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c index b045b468e4..fb6a5e1c1f 100644 --- a/util/romcc/romcc.c +++ b/util/romcc/romcc.c @@ -2870,7 +2870,7 @@ static struct triple *do_farg(struct compile_state *state, unsigned i; ftype = func->type; - if((index < 0) || (index >= (ftype->elements + 2))) { + if(index >= (ftype->elements + 2)) { internal_error(state, func, "bad argument index: %d", index); } first = RHS(func, 0); @@ -18328,7 +18328,7 @@ static void print_interference_block( } /* Do a bunch of sanity checks */ valid_ins(state, ptr); - if ((ptr->id < 0) || (ptr->id > rstate->defs)) { + if (ptr->id > rstate->defs) { internal_error(state, ptr, "Invalid triple id: %d", ptr->id); } @@ -18943,7 +18943,7 @@ static void graph_ins( */ for(entry = live; entry; entry = entry->next) { struct live_range *lr; - if ((entry->member->id < 0) || (entry->member->id > rstate->defs)) { + if (entry->member->id > rstate->defs) { internal_error(state, 0, "bad entry?"); } lr = rstate->lrd[entry->member->id].lr; @@ -19915,7 +19915,7 @@ static void verify_colors(struct compile_state *state, struct reg_state *rstate) ins = first; do { if (triple_is_def(state, ins)) { - if ((ins->id < 0) || (ins->id > rstate->defs)) { + if (ins->id > rstate->defs) { internal_error(state, ins, "triple without a live range def"); } @@ -19950,7 +19950,7 @@ static void color_triples(struct compile_state *state, struct reg_state *rstate) first = state->first; ins = first; do { - if ((ins->id < 0) || (ins->id > rstate->defs)) { + if (ins->id > rstate->defs) { internal_error(state, ins, "triple without a live range"); }