This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Rename md_apply_fix3 to md_apply_fix


Zack Weinberg wrote:
The only failure was on xtensa-elf, for unrelated reasons:

../../../src/gas/config/tc-xtensa.c: In function `release_resources':
../../../src/gas/config/tc-xtensa.c:5880: warning: comparison is always
true due to limited range of data type
make[2]: *** [tc-xtensa.o] Error 1

I have committed this patch to fix the problem.


2005-06-07 Bob Wilson <bob.wilson@acm.org>

        * config/tc-xtensa.h (resource_table): Change units to unsigned chars.
        * config/tc-xtensa.c (new_resource_table): Likewise.
        (resize_resource_table): Likewise.
        (release_resources): Fix assertion for unsigned values.


Index: config/tc-xtensa.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.h,v
retrieving revision 1.13
diff -u -p -r1.13 tc-xtensa.h
--- config/tc-xtensa.h	6 May 2005 21:27:47 -0000	1.13
+++ config/tc-xtensa.h	7 Jun 2005 18:25:12 -0000
@@ -418,7 +418,7 @@ typedef struct
   opcode_num_units_func opcode_num_units;
   opcode_funcUnit_use_unit_func opcode_unit_use;
   opcode_funcUnit_use_stage_func opcode_unit_stage;
-  char **units;
+  unsigned char **units;
 } resource_table;
 
 resource_table *new_resource_table
Index: config/tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.43
diff -u -p -r1.43 tc-xtensa.c
--- config/tc-xtensa.c	7 Jun 2005 17:54:18 -0000	1.43
+++ config/tc-xtensa.c	7 Jun 2005 18:25:13 -0000
@@ -5788,9 +5788,9 @@ new_resource_table (void *data,
   rt->opcode_unit_use = ouuf;
   rt->opcode_unit_stage = ousf;
 
-  rt->units = (char **) xcalloc (cycles, sizeof (char *));
+  rt->units = (unsigned char **) xcalloc (cycles, sizeof (unsigned char *));
   for (i = 0; i < cycles; i++)
-    rt->units[i] = (char *) xcalloc (nu, sizeof (char));
+    rt->units[i] = (unsigned char *) xcalloc (nu, sizeof (unsigned char));
 
   return rt;
 }
@@ -5820,11 +5820,13 @@ resize_resource_table (resource_table *r
   old_cycles = rt->allocated_cycles;
   rt->allocated_cycles = cycles;
 
-  rt->units = xrealloc (rt->units, sizeof (char *) * rt->allocated_cycles);
+  rt->units = xrealloc (rt->units,
+			rt->allocated_cycles * sizeof (unsigned char *));
   for (i = 0; i < old_cycles; i++)
-    rt->units[i] = xrealloc (rt->units[i], sizeof (char) * rt->num_units);
+    rt->units[i] = xrealloc (rt->units[i],
+			     rt->num_units * sizeof (unsigned char));
   for (i = old_cycles; i < cycles; i++)
-    rt->units[i] = xcalloc (rt->num_units, sizeof (char));
+    rt->units[i] = xcalloc (rt->num_units, sizeof (unsigned char));
 }
 
 
@@ -5876,8 +5878,8 @@ release_resources (resource_table *rt, x
     {
       xtensa_funcUnit unit = (rt->opcode_unit_use) (rt->data, opcode, i);
       int stage = (rt->opcode_unit_stage) (rt->data, opcode, i);
+      assert (rt->units[stage + cycle][unit] > 0);
       rt->units[stage + cycle][unit]--;
-      assert (rt->units[stage + cycle][unit] >= 0);
     }
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]