[coreboot-gerrit] New patch to review for coreboot: cf5f5a0 utils/romcc.c: spurious unsigned integer comparisons.

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Thu Feb 20 10:10:42 CET 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5275

-gerrit

commit cf5f5a08dfa9c3c641c04e4faed38598c5bce8f9
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Thu Feb 20 20:06:42 2014 +1100

    utils/romcc.c: spurious unsigned integer comparisons.
    
    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 <eocallaghan at alterapraxis.com>
---
 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 3ac42f7..d6317f1 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);
@@ -18329,7 +18329,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);
 		}
@@ -18944,7 +18944,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;
@@ -19916,7 +19916,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");
 			}
@@ -19951,7 +19951,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");
 		}



More information about the coreboot-gerrit mailing list