This is the mail archive of the
mailing list for the GCC project.
Re: reg_n_info lossage patch
- To: egcs-bugs at cygnus dot com
- Subject: Re: reg_n_info lossage patch
- From: grahams at rcp dot co dot uk
- Date: Tue, 11 Aug 1998 18:54:08 GMT
I've have cause to take a look the allocate_reg_info() code in
gcc/regclass.c and the 0041.html patch submitted by Richard Henderson"
I think the allocate_reg_info() routine has a few more bugs which are
due to fence post errors.
1. The test (after applying patch)
if (min_index <= regno_allocated && min < max_index)
if (min_index < regno_allocated && min <= max_index)
The change to the 1st test is needed because "min_index" is an
index whereas "regno_allocated" is the # of entries.
The change to the 2nd test is needed because "min" is the index
of the first new entry.
2. I can't see how the test "if (max > regno_allocated)" would ever be
other than as a result of a bug at which point I think an abort()
Assuming I've missed something and max maybe be greater than
regno_allocated. Then the test and subsequent assigment are wrong
and should be changed to.
if (max >= regno_allocated)
max = regno_allocated - 1;
This is because "max" is an index whereas "regno_allocated" is the
# of entries. Setting max to the # of entries whould logically cause
array bounds to be exceeded.